I am trying to write a VBScript to open an excel. Run the macro and Save it as xlsx. Post this close the excel document.
Pardon my knowledge of VBScript as I am still novice and lack detailed knowledge of VBScript.
However, this is important and the piece of code I have written is not able to help me out.
Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.Workbooks.Open("C:\Users\Desktop\Report0165.xlsm")
objExcel.Application.Visible = True
objExcel.Workbooks.Add
objExcel.Cells(1, 1).Value = "Test value"
objExcel.Application.Run "Report0165.xlsm"
objExcel.ActiveWorkbook.SaveAs "Report0165.xlsx", FileFormat = 51
objExcel.ActiveWorkbook.Close saveChanges=True
objExcel.Application.Quit
WScript.Echo "Finished."
WScript.Quit
I am trying and still I am unable to do this basic things: I need to execute all the macros inside the excel. Hence I have not specified the macro name.
a. Open excel with macro
b. run macro
c. Save the xlsm to xlsx
d. close the document
Can anyone please guide on where am I going wrong.