Variables and Basic
Posted: Tue Aug 16, 2011 11:56 am
hi, im looking to get robotask after finding automate too unreliable, but i need to know how to do this task, as i am having no luck doing it on my trial copy.it goes like this1) create variable strfile2) loop 3)move/copy file 4) internal basic script 5) move copy file6 end loopthe problem is that i store the names of the files i move in the "strfile" variable but in the basic script i cant call on this variable to open the file, as it says it does not recognise it as a variable (the error log reads, "was expecting a variable") here is the basic script if it helps:Any help would be much appreciated! thanks,domalino
Code: Select all
Sub Main<br style="font-family: Courier New,Courier,mono; font-style: italic;"><br style="font-family: Courier New,Courier,mono; font-style: italic;"> Dim objExcel As Object<br style="font-family: Courier New,Courier,mono; font-style: italic;"> Dim wbkExcel1 As Object<br style="font-family: Courier New,Courier,mono; font-style: italic;"> Set objExcel = CreateObject( "Excel.Application")<br style="font-family: Courier New,Courier,mono; font-style: italic;"><br style="font-family: Courier New,Courier,mono; font-style: italic;"> objExcel.Visible = False<br style="font-family: Courier New,Courier,mono; font-style: italic;"> objExcel.Workbooks.Open Filename:="\\Server-1\production_share\Test Auto Bucket\Automates Tasks and Other Stuff\Macro Storage\PERSONAL.XLSB"<br style="font-family: Courier New,Courier,mono; font-style: italic;"> objExcel.Workbooks.Open Filename:= %STRFILE%<br style="font-family: Courier New,Courier,mono; font-style: italic;"><br style="font-family: Courier New,Courier,mono; font-style: italic;"> objExcel.Run "PERSONAL.xlsb!Lighthouse_Converter"<br style="font-family: Courier New,Courier,mono; font-style: italic;"> objExcel.Run "PERSONAL.xlsb!validateLighthouseFormat"<br style="font-family: Courier New,Courier,mono; font-style: italic;"><br style="font-family: Courier New,Courier,mono; font-style: italic;"> Set wbkExcel1 = objExcel.ActiveWorkbook<br style="font-family: Courier New,Courier,mono; font-style: italic;"> 'Set wbkExcel1 = objExcel.ActiveWorkbook.Worksheets(1)<br style="font-family: Courier New,Courier,mono; font-style: italic;"> wbkExcel1.Close SaveChanges:= True<br style="font-family: Courier New,Courier,mono; font-style: italic;"><br style="font-family: Courier New,Courier,mono; font-style: italic;"><br style="font-family: Courier New,Courier,mono; font-style: italic;"> objExcel.ActiveWorkbook.Close False<br style="font-family: Courier New,Courier,mono; font-style: italic;"><br style="font-family: Courier New,Courier,mono; font-style: italic;"> objExcel.Quit<br style="font-family: Courier New,Courier,mono; font-style: italic;"><br style="font-family: Courier New,Courier,mono; font-style: italic;">End Sub<br>