I am writing a macro that starts in IBM Reflection and pulls information from an Excel file to put into a Reflection Session to process. The problem that I am having is that when the sequence is complete the macro is supposed to add 1 to LocationCount and loop back around to run the sequence again, but when the macro gets to the end it loops back around and the value of LocationCount does not change. I have tried to figure out what is wrong but all the syntax seems correct. Does anyone have any suggestions?
I have included the macro for you to look over.
Dim LocationCount As Integer
Dim ExcelApp As Excel.Application
Dim ExcelWorkbook As Excel.Workbook
Dim StartPos As String
Set ExcelApp = New Excel.Application
Set ExcelWorkbook = ExcelApp.Workbooks.Open("R:\My Documents\Location Codes To Delete Rates.xls")
LocationCount = 2
StartPos = ExcelWorkbook.Sheets("Sheet1").Range("A" & LocationCount)
With Session
Do While StartPos <> ""
.RunMacro "NewMacros.Location_Code_Input", ""
Let LocationCount = LocationCount + 1
If StartPos = "" Then Exit Do
Loop
End With
I have included the macro for you to look over.
Dim LocationCount As Integer
Dim ExcelApp As Excel.Application
Dim ExcelWorkbook As Excel.Workbook
Dim StartPos As String
Set ExcelApp = New Excel.Application
Set ExcelWorkbook = ExcelApp.Workbooks.Open("R:\My Documents\Location Codes To Delete Rates.xls")
LocationCount = 2
StartPos = ExcelWorkbook.Sheets("Sheet1").Range("A" & LocationCount)
With Session
Do While StartPos <> ""
.RunMacro "NewMacros.Location_Code_Input", ""
Let LocationCount = LocationCount + 1
If StartPos = "" Then Exit Do
Loop
End With