Hello,
I am trying to convert a VBA script to VBS. The script below gives me an error on the line starting with LastRow (invalid or unqualified reference).
Not sure how to fix this.
Thanks
I am trying to convert a VBA script to VBS. The script below gives me an error on the line starting with LastRow (invalid or unqualified reference).
Not sure how to fix this.
Thanks
Code:
SPATH = "Z:\MyNetworkScriptsNew\Simulation_Journal\"
strExcelPath = SPATH + "Simulations_Journal_ANTEG_202004_0723.xlsm"
Set objExcel = CreateObject("Excel.Application")
' sheet1 - MAIN
' sheet2 - Simulations_journal
' sheet3 - Misc
objExcel.Workbooks.Open strExcelPath
objExcel.Visible = True
Set objSheet = objExcel.ActiveWorkbook.Worksheets(2)
LastRow = objExcel.ActiveWorkbook.Worksheets(2).Cells(.Rows.Count, 4).End(xlUp).Row
pako = CStr(LastRow) + Chr(10) + CStr(LastColumn)
objExcel.Cells(LastRow + 2, 1).value = Now
objExcel.Cells(LastRow + 2, 2).value = Now
objExcel.Cells(LastRow + 2, 4).value = MyProjectName
objExcel.Cells(LastRow + 2, 5).value = MyProjectPath
' Excel Save, Quit and Unload
objExcel.DisplayAlerts = False
objExcel.ActiveWorkbook.Save
objExcel.ActiveWorkbook.Close
objExcel.Application.Quit
objExcel.DisplayAlerts = True
Set objExcel = Nothing