[FONT="]Hello,[/FONT]
[FONT="]I am currently writing a VBScript in order to schedule it to run twice everyday. The goal of the Script is to open a Read-only Excel file, execute a macro and afterwards save the file with the same name. It is extremely important that the file is saved with the same name, so I don't have to change the script each time I want to run it.[/FONT]
[FONT="]After looking it up on some websites, I came up with the following code:[/FONT]
[FONT="]
Dim xlApp, xlBook SetAttribute "C:\Users\e322016\Downloads\Book1.xlsm", vbNormal Set xlApp = CreateObject("Excel.Application") xlApp.DisplayAlerts = False Set xlBook = xlApp.Workbooks.Open("C:\Users\e322016\Downloads\Book1.xlsm", 0, True)[/FONT]
[FONT="]xlApp.Run "Macro1"[/FONT]
[FONT="]xlbook.Save xlBook.Close False set xlBook = Nothing[/FONT]
[FONT="]xlApp.Quit Set xlApp = Nothing[/FONT]
[FONT="]WScript.Echo "Finished." WScript.Quit[/FONT]
[FONT="]
However, this code gives me the Error Code 800A000D regarding the SetAttribute function. I have tried to rewrite it a couple of times, but I still haven't found a solution to the problem.
[/FONT]
[FONT=Segoe UI, Arial, sans-serif]To [/FONT]provide more context: The excel file I am mentioning, updates the online performance of different products that are currently in promotion. The goal of the file is to be in the company network where every member of the selected network can check their items' performance.
[FONT="]Thanks in advance! [/FONT]
[FONT="]I am currently writing a VBScript in order to schedule it to run twice everyday. The goal of the Script is to open a Read-only Excel file, execute a macro and afterwards save the file with the same name. It is extremely important that the file is saved with the same name, so I don't have to change the script each time I want to run it.[/FONT]
[FONT="]After looking it up on some websites, I came up with the following code:[/FONT]
[FONT="]
Dim xlApp, xlBook SetAttribute "C:\Users\e322016\Downloads\Book1.xlsm", vbNormal Set xlApp = CreateObject("Excel.Application") xlApp.DisplayAlerts = False Set xlBook = xlApp.Workbooks.Open("C:\Users\e322016\Downloads\Book1.xlsm", 0, True)[/FONT]
[FONT="]xlApp.Run "Macro1"[/FONT]
[FONT="]xlbook.Save xlBook.Close False set xlBook = Nothing[/FONT]
[FONT="]xlApp.Quit Set xlApp = Nothing[/FONT]
[FONT="]WScript.Echo "Finished." WScript.Quit[/FONT]
[FONT="]
However, this code gives me the Error Code 800A000D regarding the SetAttribute function. I have tried to rewrite it a couple of times, but I still haven't found a solution to the problem.
[/FONT]
[FONT=Segoe UI, Arial, sans-serif]To [/FONT]provide more context: The excel file I am mentioning, updates the online performance of different products that are currently in promotion. The goal of the file is to be in the company network where every member of the selected network can check their items' performance.
[FONT="]Thanks in advance! [/FONT]