Hello,
Can anyone help to explain why I'm getting the Error: Variable 'objSht' is used before it's assigned
in my code snippet below:
If reqXLSS Then
'Start Excel and get Application object...
objXL = CreateObject("Excel.Application")
objXL.Visible = True
'Get new workbook
objWrkBk = objXL.Workbooks.Open("C:\Temp\HLDRC_Proj.xlsx") 'new SS...clears out any previous data.
objSht = objWrkBk.Worksheets("Sheet1")
objSht.Name = "HLDRC Object Lists"'add tab name to the first tab.....
objSht.Cells(1, 2).Value = "Project Name"'add some dummy data....
objSht.Cells(1, 3).Value = "Date"'add some dummy data....
EndIf
'[more code in here....]
'Clear out anything left in the Extraction_ListBox....
frmMain.Extraction_ListBox.Items.Clear()
strListItem = "OBJECT LIST COLLECTION:"
Call AddToListBox(strListItem)
If reqXLSS Then
objSht.Cells(1, 1).Value = "OBJECT LIST COLLECTION" <<=== Error: Variable 'objSht' is used before it's assigned.
EndIf
Question: Is the compiler that pickey that it doesn't recognize the objSht assignment within my 'If' statement?
Thanks for any help,
Grant
Can anyone help to explain why I'm getting the Error: Variable 'objSht' is used before it's assigned
in my code snippet below:
If reqXLSS Then
'Start Excel and get Application object...
objXL = CreateObject("Excel.Application")
objXL.Visible = True
'Get new workbook
objWrkBk = objXL.Workbooks.Open("C:\Temp\HLDRC_Proj.xlsx") 'new SS...clears out any previous data.
objSht = objWrkBk.Worksheets("Sheet1")
objSht.Name = "HLDRC Object Lists"'add tab name to the first tab.....
objSht.Cells(1, 2).Value = "Project Name"'add some dummy data....
objSht.Cells(1, 3).Value = "Date"'add some dummy data....
EndIf
'[more code in here....]
'Clear out anything left in the Extraction_ListBox....
frmMain.Extraction_ListBox.Items.Clear()
strListItem = "OBJECT LIST COLLECTION:"
Call AddToListBox(strListItem)
If reqXLSS Then
objSht.Cells(1, 1).Value = "OBJECT LIST COLLECTION" <<=== Error: Variable 'objSht' is used before it's assigned.
EndIf
Question: Is the compiler that pickey that it doesn't recognize the objSht assignment within my 'If' statement?
Thanks for any help,
Grant