Maybe an explanation of how VBScript and Macro Scheduler interact will help here.
Basically VBScript is a completely separate programming language from the macro script language. Anything VBScript needs to be entirely within the VBStart and VBEnd statements. Macro script commands CANNOT be inside the VBStart/VBEnd.
Macro script commands execute first regardless of where the VBStart/VBEnd block is encountered in your code. The program contained within VBStart/VBEnd is only executed when a macro script statement of VBEval or VBRun is encountered.
So, your issues seemed to be that you mixed the statements up violating the rules I outlined above.
In my corrected code post I simply moved the macro script commands outside of the VBEnd statement where they belong.
If there are still issues, reply back and we'll go from there.
Good Luck.
Code: Select all
VBSTART
Dim xlApp
Sub CreateExcelObj
Set xlApp = CreateObject("Excel.Application")
End Sub
Sub ExcelExample (mystring,myrange,myAddNew,mySave)
Dim xlBook
Dim xlSheet
If (myAddNew = "True") THEN
Set xLBook = xlApp.Workbooks.Open("c:\neteller saldo1.xlsx")
Else
Set xlBook = xlApp.ActiveWorkbook
End if
Set xlSheet = xlBook.Worksheets(1)
xlApp.visible = True
'optionally make the sheet visible
'xlSheet.Application.Visible = True
xlSheet.Range(myrange).Value = mystring
'etc
'If (mySave = "True") THEN
' xlSheet.SaveAs "c:\neteller saldo.xlsx"
'End if
End Sub
Sub QuitExcel
xlApp.Quit
Set xlSheet = Nothing
Set xlBook = Nothing
Set xlApp = Nothing
End Sub
VBEND
//Get Web fields for user 1
// code goes here
//Move the mouse cursor out of harm's way to avoid causing mouseover events to interrupt
MouseMove>0,0
Let>delay=1
IE_Create>0,IE[0]
// go to Neteller webpage
IE_Navigate>%IE[0]%,http://neteller.com/,r
IE_Wait>%IE[0]%,r
Wait>delay
// enter secure id
Let>FrameName={""}
Let>FormName={"signInform"}
Let>FieldName={"signInform:secureId"}
Let>FieldValue={"xxx"}
IE_FormFill>%IE[0]%,str:FrameName,str:FormName,str:FieldName,str:FieldValue,0,r
// enter password
Let>FrameName={""}
Let>FormName={"signInform"}
Let>FieldName={"signInform:password"}
Let>FieldValue={"xxx"}
IE_FormFill>%IE[0]%,str:FrameName,str:FormName,str:FieldName,str:FieldValue,0,r
// press submit
Let>FrameName={""}
Let>FormName={"signInform"}
Let>TagValue={"signInform:submit"}
IE_ClickTag>%IE[0]%,str:FrameName,str:FormName,INPUT,NAME,str:TagValue,r
IE_Wait>%IE[0]%,r
Wait>delay
WaitWindowOpen>money transfer*
wait>3
// get balance
//Modify buffer size if required ...
Let>SPAN12_SIZE=4098
IE_ExtractTag>%IE[0]%,,SPAN,12,0,SPAN12,r
MidStr>r_6,1,r,SPAN12
// get name
//Modify buffer size if required ...
Let>SPAN8_SIZE=4098
IE_ExtractTag>%IE[0]%,,SPAN,8,0,SPAN8,r
MidStr>r_6,1,r,SPAN8
// Closes the Neteller window
CloseWindow>Money Transfer & Online Payment | NETELLER - Client Account - Windows Internet Explorer
//
// Now save the fields to spreadsheet
VBRun>CreateExcelObj
VBRun>ExcelExample,SPAN12,A1,True,False
VBRun>ExcelExample,SPAN8,A2,False,False
//Get Web fields for user 2
// code goes here
//Move the mouse cursor out of harm's way to avoid causing mouseover events to interrupt
MouseMove>0,0
Let>delay=1
IE_Create>0,IE[0]
// go to website
IE_Navigate>%IE[0]%,http://neteller.com/,r
IE_Wait>%IE[0]%,r
Wait>delay
// enter secure
Let>FrameName={""}
Let>FormName={"signInform"}
Let>FieldName={"signInform:secureId"}
Let>FieldValue={"xxx"}
IE_FormFill>%IE[0]%,str:FrameName,str:FormName,str:FieldName,str:FieldValue,0,r
// enter password
Let>FrameName={""}
Let>FormName={"signInform"}
Let>FieldName={"signInform:password"}
Let>FieldValue={"xxx"}
IE_FormFill>%IE[0]%,str:FrameName,str:FormName,str:FieldName,str:FieldValue,0,r
// press submit
Let>FrameName={""}
Let>FormName={"signInform"}
Let>TagValue={"signInform:submit"}
IE_ClickTag>%IE[0]%,str:FrameName,str:FormName,INPUT,NAME,str:TagValue,r
IE_Wait>%IE[0]%,r
Wait>delay
WaitWindowOpen>money transfer*
wait>3
// get balance
//Modify buffer size if required ...
Let>SPAN12_SIZE=4098
IE_ExtractTag>%IE[0]%,,SPAN,12,0,SPAN12,r
MidStr>r_6,1,r,SPAN12
// get name
//Modify buffer size if required ...
Let>SPAN8_SIZE=4098
IE_ExtractTag>%IE[0]%,,SPAN,8,0,SPAN8,r
MidStr>r_6,1,r,SPAN8
// Closes the Neteller window
CloseWindow>Money Transfer & Online Payment | NETELLER - Client Account - Windows Internet Explorer
VBRun>ExcelExample,SPAN12,C1,False,False
VBRun>ExcelExample,SPAN8,C2,False,True
//VBRun>QuitExcel
Label>end_script