Results 1 to 5 of 5
  1. #1
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: Application.Run (VBA/Excel/2003)

    That's just the syntax Application.Run expects. If you set a reference to the other project, then you could just use:
    <code>UnderDevelopment.Macro1</code>
    Regards,
    Rory

    Microsoft MVP - Excel

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

    Application.Run (VBA/Excel/2003)

    <P ID="edit" class=small>(Edited by wdwells on 05-Jul-08 07:32. 'Application' spelling corrected.)</P>I have a workbook:
    File name: Book1.xls
    Project name: UnderDevelopment

    From a different project, the command:
    Application.Run "Book1.xls!Module1.Macro1" is successful, but the command
    Application.Run "UnderDevelopment.Macro1" fails

    Can someone please explain where I have gone wrong?

    T.I.A.
    Regards
    Don

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

    Re: Application.Run (VBA/Excel/2003)

    Thank you Rory; That mystery is solved.

    I also find that the command:
    Application.Run "Test File.xls!Module1.Macro1" will fail because the filename contains a space (The macro cannot be found)..

    Is this an anomaly, or a recognized feature?

    T.I.A.
    Regards
    Don

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Application.Run (VBA/Excel/2003)

    You can put single quotes around the workbook name:
    <code>
    Application.Run "'Test File.xls'!Module1.Macro1"
    </code>
    BTW if the name Macro1 is unique within Test File.xls, you can omit the module name:
    <code>
    Application.Run "'Test File.xls'!Macro1"
    </code>
    However, if you have several modules containing a macro named Macro1, the module name is required.

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

    Re: Application.Run (VBA/Excel/2003)

    Thank you Hans. <img src=/S/thumbup.gif border=0 alt=thumbup width=15 height=15>
    Regards
    Don

Posting Permissions

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