Hi all,
I have an issue with an Excel file that I'm generating through a VBA code in Access.
I generate a report of some data that is in Access 2007, on an Excel file and add a "processing view" button to do some operations.
To add that button, I add a module to the Excel file in this way:
And when the file is generated, everything works fine.
The file is also saved in this way:
The problem is when I close that generated file, and then I open it again. When clicking the button I get the message:
And effectively, I check the code and the imported module is not there.
Can Somebody help me, telling me how to save the imported module as well? I've tried to change the FileFormatNum and the FileExtStr, but I keep having the same results.
Thanks in advance, I hope somebody is able to help me.
Victor
I have an issue with an Excel file that I'm generating through a VBA code in Access.
I generate a report of some data that is in Access 2007, on an Excel file and add a "processing view" button to do some operations.
To add that button, I add a module to the Excel file in this way:
Code:
'Add the view button
appExcel.ActiveSheet.Buttons.Add(520, 110, 130, 25).Select
appExcel.ActiveSheet.Shapes("Button 1").Select
appExcel.Selection.Characters.Text = "Processing View"
appExcel.VBE.ActiveVBProject.VBComponents.Import "C:\BLA\Change_Views_Script.bas"
appExcel.ActiveSheet.Shapes("Button 1").Select
appExcel.Selection.OnAction = "Change_Views"
And when the file is generated, everything works fine.
The file is also saved in this way:
Code:
appExcel.ActiveWorkbook.SaveAs FileName:="C:\BLA\abc": FileExtStr = ".xlsb": FileFormatNum = 50
The problem is when I close that generated file, and then I open it again. When clicking the button I get the message:
Cannot run the macro 'Change_Views'. The macro may not be available in this workbook or all macros may be disabled
And effectively, I check the code and the imported module is not there.
Can Somebody help me, telling me how to save the imported module as well? I've tried to change the FileFormatNum and the FileExtStr, but I keep having the same results.
Thanks in advance, I hope somebody is able to help me.
Victor