Results 1 to 2 of 2
  1. #1
    Silver Lounger
    Join Date
    Jul 2001
    Location
    Ottawa, Ontario, Canada
    Posts
    1,609
    Thanks
    0
    Thanked 1 Time in 1 Post

    Trying to run a macro from a different project (VBA 6 Word 2K)

    Hello out there

    In attempting to run a macro that is contained within another project I have tried the following code unsuccessfully. Can someone please tell me where I have erred?

    Word.Application.Run "D:MacrosMacroSource.About.About"

    Answers to questions you might ask:
    1. The called project is a template named "MacroSource.dot"
    2. Both the calling and called projects reside in the same directory
    3. Both projects are Word Templates
    Regards
    Don

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Trying to run a macro from a different project

    Application.Run typically is used when the code container is "open" and "in scope" at the time you call the procedure. For example, MacroSource.dot could be open as a global template. You should be able to find the procedure in the macros dialog (unless it takes parameters, in which case Word does not display it there.)

    If the template is open, then the next issue is the syntax; a path to a file on disk shouldn't be required, and actually you omitted the file name. For examples of syntax that should work, see <post#=335145>post 335145</post#> and <post#=234629>post 234629</post#>. Someone may post and say that you can't do it without setting a Reference to the other template under Tools>References. Just ignore him.

    If the template is not open or in scope, you either can open it yourself (perhaps by adding it as a global template) or perhaps someone has a solution that will dynamically open it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •