Greetings:
I have a question. Below is my code that I am using to open a xlsm file, run a macro, save the file as another file name. The code is working just fine. The problem I am having is when the Save As is called I am getting (2) dialogue boxes. The first one says
"The following resources cannot be saved in macro-free workbooks: *VB Project. TO save a file with these features, click no, and then choose a macro-enabled file type in the file type list. To continue saving as a macro-free workbook click yes." --- Here I want to choose yes
The second one says
"Privacy warning: This document contains macros, ActiveX controls, XML expansion pack information or web components. These may include personal information that cannot be removed by the document inspector." --- Here I want to choose OK.
My question is I want my script to be automatic and not just hang at the end waiting for an input. Is there a way I can prevent these messages from appearing and just have the excel save the file as and close without getting these boxes or is there away I can add code to accept yes to the first box and no to the second? I do want to save the file as macro free.
Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.Workbooks.Open ("C:\MyStuff\Template.xlsm")
objExcel.Run "ErrorLogTemplate.xlsm!'Macro1'"
objExcel.ActiveWorkbook.SaveAs "C:\MyStuff\Template "&MyDate&".xlsx", 51
objExcel.Quit
Thank you for any help or advice.
Regard,
Keith
I have a question. Below is my code that I am using to open a xlsm file, run a macro, save the file as another file name. The code is working just fine. The problem I am having is when the Save As is called I am getting (2) dialogue boxes. The first one says
"The following resources cannot be saved in macro-free workbooks: *VB Project. TO save a file with these features, click no, and then choose a macro-enabled file type in the file type list. To continue saving as a macro-free workbook click yes." --- Here I want to choose yes
The second one says
"Privacy warning: This document contains macros, ActiveX controls, XML expansion pack information or web components. These may include personal information that cannot be removed by the document inspector." --- Here I want to choose OK.
My question is I want my script to be automatic and not just hang at the end waiting for an input. Is there a way I can prevent these messages from appearing and just have the excel save the file as and close without getting these boxes or is there away I can add code to accept yes to the first box and no to the second? I do want to save the file as macro free.
Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.Workbooks.Open ("C:\MyStuff\Template.xlsm")
objExcel.Run "ErrorLogTemplate.xlsm!'Macro1'"
objExcel.ActiveWorkbook.SaveAs "C:\MyStuff\Template "&MyDate&".xlsx", 51
objExcel.Quit
Thank you for any help or advice.
Regard,
Keith