JoeyGaspard
Board Regular
- Joined
- Jul 22, 2019
- Messages
- 164
I am trying to write this script that will open excel, run a macro, then save the specified worksheet as a csv, the process works up to the point of saving the csv. I appreciate any help or insight! Below is the script and also a screenshot of the error I am getting:
Option Explicit
Dim xlApp, xlBook
Set xlApp = CreateObject("Excel.Application")
xlApp.visible=true
Set xlBook = xlApp.Workbooks.Open("c:\adp\UploadV1.xlsm", 0, True)
xlApp.Run "ProcessTime"
Set objWorksheet = objWorkbook.Worksheets("Upload")
objWorksheet.SaveAs "c:\ADP\PunchReport.csv", xlCSV
objExcel.Quit
xlBook.Close
xlApp.Quit
Set xlBook = Nothing
Set xlApp = Nothing
Option Explicit
Dim xlApp, xlBook
Set xlApp = CreateObject("Excel.Application")
xlApp.visible=true
Set xlBook = xlApp.Workbooks.Open("c:\adp\UploadV1.xlsm", 0, True)
xlApp.Run "ProcessTime"
Set objWorksheet = objWorkbook.Worksheets("Upload")
objWorksheet.SaveAs "c:\ADP\PunchReport.csv", xlCSV
objExcel.Quit
xlBook.Close
xlApp.Quit
Set xlBook = Nothing
Set xlApp = Nothing