Hi,
This SUB in excel 2007 must open a file containing macros (so it's an .xlsm file).
The file is opened, but oftenly macros are not automatically enabled. Sometimes excel shows the traditional Warning message asking if I'd like to enable macros, but many times it doesn't. So in those cases I need to go to the opened file and click the Options button to manually enable macros. This is against the automatization process I'm trying to implement, as the amount of files I need to open is high.
Could anybody suggest how to always automatically enable macros of the file to be opened?
Sub Open_MRA_Report_File(Working_Path, MRA_Pool_Filename) Dim This_Datos_File As String This_Datos_File = Working_Path + "\" + MRA_Pool_Filename Workbooks.Open FileName:=This_Datos_File, UpdateLinks:=3 End Sub
Last edited by aspicuelta; 06-10-2011 at 12:35 PM.
Macros should be automatically enabled if you open a workbook in code unless you have explicitly changed the application.automationsecurity property in your code and forgotten to reset it.
Hi,
I have no code explicity changing the Application.AutomationSecurity property, but now I added this portion of code that runs when the master file (the one containing the macro that opens other files) is opened, and it worked OK.
It means, security level is set to Low when the master file is opened, and then the macros of the auxiliar file are automatically enabled once it is opened.
Many thanks for your comment.
Private Sub Workbook_Open() Application.AutomationSecurity = msoAutomationSecurityLow End Sub
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks