Jump to content

TheScarab

Members
  • Posts

    1
  • Joined

  • Last visited

Everything posted by TheScarab

  1. This code is an example of what I always find. It (per my understanding and experimenting) opens a blank Excel spreadsheet and works from there. My problem is that I have an existing spreadsheet (that may or may not be opened yet) and I need to clear a range before I paste new data into it. I cannot seem to get a way to pass MY spreadsheet to autoit. I have included my current code below (with multiple trys commented out). Can someone help me to see what I am doing wrong? ;need to clear the cells a2:w10001 ;$MyExcel = Objget("Excel.Application") ;$MyExcel = ("Microsoft Excel - Particle.xlsm") $MyExcel = ("Particle.xlsm") MsgBox(262144, "Testing", "Cell clear algorithm starting...",0) ;WITH $MyExcel.activesheet ;MsgBox(262144, "Testing", "inside the 'with'...",0) ;.range("A2:W10001").select ;.range("A2:W10001").clear ;MsgBox(262144, "Testing", "cells should be clear...",0) ;ENDWITH ;$MyExcel.activesheet.range("A2:W10001").select ;$MyExcel.activesheet.range("A2:W10001").clear ;$oExcel = ObjCreate("Excel.Application") ;$oExcel.Visible = 1 ;$oExcel.WorkBooks.Open ($filename1) $MyExcel.Range ("A2","W10001").clear MsgBox(262144, "Testing", "finished clearing...",0) Sleep(1000) I get this error currently and do not know what to do about it: "C:UserskscarabiDesktopAspex Project0000Testingtemp.au3" (32) : ==> Variable must be of type "Object".: $MyExcel.Range ("A2","W10001").clear $MyExcel^ ERROR
×
×
  • Create New...