Dear all,
I want to open an excel file, run a macro and save that file through a VBS. That Excel file has been saved with the "read-only recommended" available in Save As\Tools\General Options.
Here is my code:
'___________________________
Set fso = CreateObject("Scripting.FileSystemObject")
Set myxlApplication = CreateObject("Excel.Application")
Set myWorkBook = myxlApplication.Workbooks.Open("G:\aig\ThatFile.xlsm",0,False,1,"Pass","Pass",False)
myWorkBook.Application.Run "DL_Mails.DownLoad_Mails"
myWorkBook.save
myxlApplication.Quit
When I run this code, I got this message:
"ThatFile.xlsm" should be opened as read-only unless you need to save changes to it. Open as read-only ?
I know in VBA there is the code ".ChangeFileAccess Mode:=xlReadWrite" but I can't make it work with this script.
Otherwise maybe I could use something like "DoCmd.SetWarnings False" and then not display events ?
That's why I need your help guys !!
Thanks in advance
Cyrille
I want to open an excel file, run a macro and save that file through a VBS. That Excel file has been saved with the "read-only recommended" available in Save As\Tools\General Options.
Here is my code:
'___________________________
Set fso = CreateObject("Scripting.FileSystemObject")
Set myxlApplication = CreateObject("Excel.Application")
Set myWorkBook = myxlApplication.Workbooks.Open("G:\aig\ThatFile.xlsm",0,False,1,"Pass","Pass",False)
myWorkBook.Application.Run "DL_Mails.DownLoad_Mails"
myWorkBook.save
myxlApplication.Quit
When I run this code, I got this message:
"ThatFile.xlsm" should be opened as read-only unless you need to save changes to it. Open as read-only ?
I know in VBA there is the code ".ChangeFileAccess Mode:=xlReadWrite" but I can't make it work with this script.
Otherwise maybe I could use something like "DoCmd.SetWarnings False" and then not display events ?
That's why I need your help guys !!
Thanks in advance
Cyrille