Results 1 to 4 of 4
  1. #1
    2 Star Lounger
    Join Date
    Apr 2003
    Location
    England
    Posts
    124
    Thanks
    0
    Thanked 0 Times in 0 Posts

    recuring private sub (office xp 2000)

    i have some 5 different macros which all use identical private sub,
    can any one suggest a method where by i just have 1 lot of " Private sub's" and a way to call the individual private sub from different main programes

  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: recuring private sub (office xp 2000)

    VBA supports calling another procedure using any of the following:

    Call MyProcedure

    MyProcedure

    Application.Run "MyProcedure"

    Note that when Call is implied (second form), you generally pass parameters without parentheses, and that when Call is used explicitly, you generally use parentheses for the parameters, if any.

    Application.Run is the best for running procedures stored in another module or template.

    All of these are discussed in the VBA help files, and in posts on this board, particularly when the subject is how to run a procedure in a different template. Hope this helps.

  3. #3
    Gold Lounger
    Join Date
    Dec 2000
    Location
    New Hampshire, USA
    Posts
    3,386
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: recuring private sub (office xp 2000)

    The Sub has to be Public, not Private.

  4. #4
    2 Star Lounger
    Join Date
    Apr 2003
    Location
    England
    Posts
    124
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: recuring private sub (office xp 2000)

    sorry for the delay in replying but
    Application.Run "MyProcedure" WORKS A TREAT
    thank you

Posting Permissions

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