+ Reply to Thread
Results 1 to 5 of 5

Run marco of a source file in the source file via marco of a master patch file

  1. #1
    Registered User
    Join Date
    03-09-2012
    Location
    Luxembourg
    MS-Off Ver
    Excel 2007
    Posts
    3

    Run marco of a source file in the source file via marco of a master patch file

    All,
    I have a master excel patch file with which I can make changes in excel files in a specific folder.
    This works fine.
    Now, I'm looking for a solution to run marcos of the source files via the patch macro.
    This works good when I enter the absolute file name plus macro name:

    Application.Run "ade - file145.xlsm'!Update2"

    but not if I use the variable for the file name which is needed in my case because the patch marco loops through all files in the source folder and should run the update2 macro in every source file.:

    Application.Run "theopenworkbook!Update2"

    I think I got something wrong with the "" settings around the variable theopenworkbook.

    Do you have any idea how to fix this?

    Thanks
    freeman

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    47,995

    Re: Run marco of a source file in the source file via marco of a master patch file

    Untested, but try:

    Please Login or Register  to view this content.

    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Registered User
    Join Date
    03-09-2012
    Location
    Luxembourg
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Run marco of a source file in the source file via marco of a master patch file

    thanks TMS, unfortunately it doesnt work. It simly doesnt run the marco if I change from true filename to any variable. that sucks....

  4. #4
    Registered User
    Join Date
    03-09-2012
    Location
    Luxembourg
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Run marco of a source file in the source file via marco of a master patch file

    Got it: yeaahh Champagne!!!

    modelfile = ActiveWorkbook.Name

    Application.Run "'" & modelfile & "'!Update2"

  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    47,995

    Re: Run marco of a source file in the source file via marco of a master patch file

    In the calling workbook (Calling Workbook.xls):

    Please Login or Register  to view this content.

    In the called workbook (Called Workbook.xls)

    Please Login or Register  to view this content.


    Note where the single quotes are surrounding the file name.

    Regards, TMS

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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