+ Reply to Thread
Results 1 to 3 of 3

Thread: How to enable macros when a file is opened from another macro

  1. #1
    Registered User
    Join Date
    07-17-2007
    Location
    Buenos Aires
    Posts
    12

    How to enable macros when a file is opened from another macro

    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.

  2. #2
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    Apparently I can't say
    MS-Off Ver
    Apparently I can't say
    Posts
    8,274

    Re: How to enable macros when a file is opened from another macro

    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.

  3. #3
    Registered User
    Join Date
    07-17-2007
    Location
    Buenos Aires
    Posts
    12

    Re: How to enable macros when a file is opened from another macro

    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

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.2.0