• Application.Run (VBA/Excel/2003)

    Author
    Topic
    #452205

    That’s just the syntax Application.Run expects. If you set a reference to the other project, then you could just use:
    UnderDevelopment.Macro1

    Viewing 1 reply thread
    Author
    Replies
    • #1115705

      (Edited by wdwells on 05-Jul-08 07:32. ‘Application’ spelling corrected.)

      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.

    • #1115717

      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.

      • #1115719

        You can put single quotes around the workbook name:

        Application.Run "'Test File.xls'!Module1.Macro1"

        BTW if the name Macro1 is unique within Test File.xls, you can omit the module name:

        Application.Run "'Test File.xls'!Macro1"

        However, if you have several modules containing a macro named Macro1, the module name is required.

    Viewing 1 reply thread
    Reply To: Application.Run (VBA/Excel/2003)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: