+ Reply to Thread
Results 1 to 4 of 4

Macros disabled on application.run() in another WB

  1. #1
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Macros disabled on application.run() in another WB

    HI,

    I work for a company that has recently migrated from Excel 2003 to Excel 2010.

    However, one Excel sheet, opens antohter, and then calls a macro in that sheet. This isnt possible because the macros are disabled. I have tried adding as a trusted document in the registry, but still nothing.

    Can anyone advise?

    Thanks
    Hope this helps

    Sometimes its best to start at the beginning and learn VBA & Excel.

    Please dont ask me to do your work for you, I learnt from Reading books, Recording, F1 and Google and like having all of this knowledge in my head for the next time i wish to do it, or wish to tweak it.
    Available for remote consultancy work PM me

  2. #2
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Macros disabled on application.run() in another WB

    Check whether this helps you

    Here is the Microsoft Help Text

    Workbooks.Open()

    By default, macros are enabled when opening files programmatically. Use the AutomationSecurity property to set the macro security mode used when opening files programmatically.

    Please Login or Register  to view this content.

    Application.AutomationSecurity Property
    Returns or sets an MsoAutomationSecurity constant that represents the security mode Microsoft Excel uses when programmatically opening files. Read/write.
    Syntax

    expression.AutomationSecurity

    expression A variable that represents an Application object.

    Remarks


    This property is automatically set to msoAutomationSecurityLow when the application is started. Therefore, to avoid breaking solutions that rely on the default setting, you should be careful to reset this property to msoAutomationSecurityLow after programmatically opening a file. Also, this property should be set immediately before and after opening a file programmatically to avoid malicious subversion.

    MsoAutomationSecurity can be one of these MsoAutomationSecurity constants.
    msoAutomationSecurityByUI. Uses the security setting specified in the Security dialog box.
    msoAutomationSecurityForceDisable. Disables all macros in all files opened programmatically without showing any security alerts.
    Note
    This setting does not disable Microsoft Excel 4.0 macros. If a file that contains Microsoft Excel 4.0 macros is opened programmatically, the user will be prompted to decide whether or not to open the file.

    msoAutomationSecurityLow. Enables all macros. This is the default value when the application is started.

    Setting ScreenUpdating to False does not affect alerts and will not affect security warnings. The DisplayAlerts setting will not apply to security warnings. For example, if the user sets DisplayAlerts equal to False and AutomationSecurity to msoAutomationSecurityByUI, while the user is on Medium security level, then there will be security warnings while the macro is running. This allows the macro to trap file open errors, while still showing the security warning if the file open succeeds.


    Example


    This example captures the current automation security setting, changes the setting to disable macros, displays the Open dialog box, and after opening the selected document, sets the automation security back to its original setting.

    Visual Basic for Applications
    Please Login or Register  to view this content.
    Last edited by :) Sixthsense :); 12-04-2014 at 04:09 AM.


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  3. #3
    Valued Forum Contributor
    Join Date
    11-22-2014
    Location
    Arizona, USA
    MS-Off Ver
    Office 365
    Posts
    973

    Re: Macros disabled on application.run() in another WB

    Registry or Trust Center. I know I ran into an issue that when on the network, if it was not set as a 'Trusted Location' Macros were disabled regardless of trust center through Excel. Also see Enable/Disable Macros. Sounds like you have exhausted enabling options but doesn't hurt to run through just to confirm.
    -If you think you are done, Start over - ELeGault

  4. #4
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: Macros disabled on application.run() in another WB

    Hi

    I have added the folder that contains the file that is opened, containing the macro, to trusted locations.

    I have the opening of this sheet in the workbook_open event, this still fails.

    However, if i close the sheet with the macro, and the one that calls it, but leave excel open, then reopen the macro caller sheet, it all works fine!

    I have this happening with registration of AddIn as reference, it errors at 1st, then re-opening it sails through.

    Can anyone advise?

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Application.OnKey runs into an infinite loop though already disabled
    By Figdor in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-05-2014, 10:36 AM
  2. Macros enabled workbook keeps saying macros are disabled
    By joker3 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-15-2013, 11:28 PM
  3. Replies: 5
    Last Post: 07-26-2012, 09:38 PM
  4. Application.EnableEvents disabled :-(
    By Jollyfrog in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-28-2010, 07:14 AM
  5. [SOLVED] Macros disabled
    By FJB in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-12-2005, 09:05 PM

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.6.0 RC 1