+ Reply to Thread
Results 1 to 8 of 8

Macros set to run upon opening, arent running when workbook is opended by 'helper'workbook

  1. #1
    Registered User
    Join Date
    12-11-2013
    Location
    auckland
    MS-Off Ver
    Excel 2010
    Posts
    56

    Question Macros set to run upon opening, arent running when workbook is opended by 'helper'workbook

    Hello,
    I am using the below code to open another workbook in Calculation Manual mode which is working fine, however when that workbook is opened, the macros set to autorun upon opening aren't running.....
    Any idea on the piece of code I need to add in to make these run? I have tried various uses of Application.Run but i get an error saying macro blah blah cannot be found or may be disabled..... Im at a loss....

    Helper workbook code:
    Please Login or Register  to view this content.
    Any Ideas?
    Last edited by morangeman; 10-24-2019 at 06:29 PM.

  2. #2
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,903

    Re: Macros set to run upon opening, arent running when workbook is opended by 'helper'work

    Your target workbook is an xlsx file, which cannot contain macros.
    Rory

  3. #3
    Registered User
    Join Date
    12-11-2013
    Location
    auckland
    MS-Off Ver
    Excel 2010
    Posts
    56
    Quote Originally Posted by rorya View Post
    Your target workbook is an xlsx file, which cannot contain macros.
    That's just a sample file name. In the actual helper file module it's labeled as workbookname.xlsm etc.

  4. #4
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,903

    Re: Macros set to run upon opening, arent running when workbook is opended by 'helper'work

    What is the code in the target workbook that should run automatically?

  5. #5
    Registered User
    Join Date
    12-11-2013
    Location
    auckland
    MS-Off Ver
    Excel 2010
    Posts
    56

    Re: Macros set to run upon opening, arent running when workbook is opended by 'helper'work

    Quote Originally Posted by rorya View Post
    What is the code in the target workbook that should run automatically?
    The workbook is set to call the sub 'Load' when opened. If I open this workbook directly, it runs the sub fine, but if I open it from this other workbook, the sub doesn't run when opened.
    Please Login or Register  to view this content.

  6. #6
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,903

    Re: Macros set to run upon opening, arent running when workbook is opended by 'helper'work

    Quote Originally Posted by morangeman View Post
    The workbook is set to call the sub 'Load' when opened.
    How?

    If it’s an auto_open routine, it has to be called explicitly by your code. If it’s Workbook_open, it will run unless you disabled events, or automation security is set to disable.

  7. #7
    Registered User
    Join Date
    12-11-2013
    Location
    auckland
    MS-Off Ver
    Excel 2010
    Posts
    56

    Re: Macros set to run upon opening, arent running when workbook is opended by 'helper'work

    Quote Originally Posted by rorya View Post
    How?

    If it’s an auto_open routine, it has to be called explicitly by your code. If it’s Workbook_open, it will run unless you disabled events, or automation security is set to disable.
    Events aren't disabled, there are no security options causing an issue. If i open the file directly it simply runs and does what it does. If i open the file from another workbook it opens but the macros don't run, even if it is setup to run automatically when opened. Both files are trusted documents so I'm at a loss......

  8. #8
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,903

    Re: Macros set to run upon opening, arent running when workbook is opended by 'helper'work

    Have you actually checked the value of application.automationsecurity to be sure?

    It’s generally not a great idea to close a workbook from its Open event so I’d suggest you use application.ontime in the first Open event to run the actual code.

+ 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. Running Macro upon the opening of a workbook?
    By taylorsm in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-07-2018, 10:32 AM
  2. Running Macro in Another Workbook without opening
    By PShingadia in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-04-2016, 06:29 AM
  3. Running a ComboBox on workbook opening
    By Cleric82 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-29-2016, 07:09 PM
  4. Opening a 2nd Workbook and Running Macro
    By Geoff. in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-09-2014, 06:17 PM
  5. Running A Macro With Information From the Workbook On Opening The Workbook
    By Jaynestown in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 10-17-2013, 03:04 PM
  6. Running macro upon opening workbook
    By don in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-04-2006, 01:20 PM
  7. [SOLVED] Detecting a another workbook has opended
    By Nigel in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-07-2005, 04:06 AM

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