+ Reply to Thread
Results 1 to 4 of 4

How to call a macro in a different file

Hybrid View

  1. #1
    Registered User
    Join Date
    04-25-2005
    Posts
    99

    How to call a macro in a different file

    I need to be able to call a macro that is located within another file. It's no problem to call another macro that is within the same file, but as my project grows, it becomes too large and cumbersome. I need to find some way to call a macro within another file.
    Say, for example I have two workbooks (FileA and FileB). Within FileA I have a macro (MacroA). At some point within that code, I need to call a macro located in FileB named MacroB.

    Is this possible?
    Is it possible to do with VB Script?

    TIA,
    DejaVu

  2. #2
    Crowbar via OfficeKB.com
    Guest

    Re: How to call a macro in a different file

    In the past I have created a custom toolbar and linked the macros from
    another workbook to it, to perform actions

    --
    Message posted via OfficeKB.com
    http://www.officekb.com/Uwe/Forums.a...mming/200603/1

  3. #3
    Registered User
    Join Date
    04-25-2005
    Posts
    99
    Thanks Crowbar... but I could not get your link to work.

    I know how to have different buttons call macros from different workbooks, but while my code is executing, I need it to call a macro from another workbook.

  4. #4
    Tom Ogilvy
    Guest

    RE: How to call a macro in a different file

    assuming FileB.xls is open

    application.Run "FileB.xls!MacroB"

    see help on the Run command for details.

    --
    Regards,
    Tom Ogilvy


    "DejaVu" wrote:

    >
    > I need to be able to call a macro that is located within another file.
    > It's no problem to call another macro that is within the same file, but
    > as my project grows, it becomes too large and cumbersome. I need to
    > find some way to call a macro within another file.
    > Say, for example I have two workbooks (FileA and FileB). Within FileA
    > I have a macro (MacroA). At some point within that code, I need to
    > call a macro located in FileB named MacroB.
    >
    > Is this possible?
    > Is it possible to do with VB Script?
    >
    > TIA,
    > DejaVu
    >
    >
    > --
    > DejaVu
    > ------------------------------------------------------------------------
    > DejaVu's Profile: http://www.excelforum.com/member.php...o&userid=22629
    > View this thread: http://www.excelforum.com/showthread...hreadid=524842
    >
    >


+ 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