+ Reply to Thread
Results 1 to 3 of 3

Indirect reference to run macro in another workbook?

  1. #1
    KR
    Guest

    Indirect reference to run macro in another workbook?

    I've tested using the following syntax, and it does run my code just find
    Application.Run "MyReallyLongComplicatedFileName.xla!TestMacro"

    However, I want to make my code more flexible, and instead of hardcoding the
    filename throughout my code every place I need to run some code from that
    XLA, I tried setting it up as an indirect reference, e.g.,
    Dim Codefile as AddIn
    set CodeFile = "MyReallyLongComplicatedFileName.xla"

    then in various parts of my code, call the macros using something more like:
    Application.Run CodeFile!TestMacro or
    Application.Run CodeFile & "!TestMacro"

    but so far, I haven't figured out the syntax to make this type of indirect
    code reference work.

    Can anyone give me a hint?
    Thanks!
    Keith




  2. #2
    KR
    Guest

    Re: Ignore this thread please

    I just figured it out...
    :-)
    Keith



  3. #3
    Forum Contributor
    Join Date
    01-21-2005
    Location
    Colorado
    MS-Off Ver
    2000,2003,2007
    Posts
    481
    Can you share your knowledge with the rest of us Keith?

    I'm having a similar problem calling code from another workbook.

    In one case it works and in the other it doesn't

    my call line is as follows:

    Application.Run (FinFile & "!AddShortCut")

    The macro exists in both workbooks but in one case it gives me a
    1004 error and says that it can't find the macro when it is clearly there.

    Any help would be appreciated.

+ 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