Hello!
I wrote a VB script that creates an .xls file, based on .xlt file. Then it calls a macro from the .xls file that populates it with information from a database. In the last step the script saves the .xls file on the disk.
I did this before with VB and Excel 2003. Now I upgraded to Excel 2007 and before it saves the file, a window pops up and tells me that:
"The following features can't be saved in macro free workbooks:
- VB project
...some yada yada about what the Yes and No option do.
And the yes and no buttons in the dialog box. " I want the script to automatically select and execute Yes in the dialog box. But I can't figure how to do this. I've also posted the script I wrote.
If you have a better approach for this please share. Thank you, Steve
Sub Main()
Dim xl_app
Set xl_app = CreateObject("Excel.Application")
xl_app.Workbooks.Open("E:\Work\Send Mail\Clienti.xls")
'Run the macro
xl_app.Run( "ImportData(""Data Source=SFA;Initial Catalog=Campofrio;
Integrated Security=SSPI;Connect Timeout=3000"", -1, 47)")
xl_app.ActiveWorkbook.SaveAs FileName="E:\Work\Send
Mail\Clients.xls",FileFormat=xlNormal
xl_app.Quit
Set xl_app = Nothing
End Sub
Now the cod works but instead of saving the file at the specified location, it saves it in My Documents folder under FALSE.xls.