Results 1 to 4 of 4
  1. #1
    2 Star Lounger
    Join Date
    Nov 2001
    Location
    Watford, Hertfordshire, England
    Posts
    129
    Thanks
    0
    Thanked 0 Times in 0 Posts

    call code from another module (Excel 2000)

    Is it possible to call a sub routine from say module2 whilst running some code in module1?
    Neil Eustice
    Woody Worshipper

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Dublin, Ireland, Republic of
    Posts
    2,697
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: call code from another module (Excel 2000)

    Provide that a sub is Public (the default), it can be called from another module by preceeding th esub name with the module name and a dot between them, eg. the following will call a sub named Macro1 in Module2 : <pre> Module2.Macro1</pre>

    or optionally<pre> Call Module2.Macro1</pre>

    The use of Call is optional, but look it up in the help as if you use with a sub requiring arguments there is a slightly different syntax.

    Andrew C

    p.s. Did you sort out the sheet & button copy problem ?

  3. #3
    2 Star Lounger
    Join Date
    Nov 2001
    Location
    Watford, Hertfordshire, England
    Posts
    129
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: call code from another module (Excel 2000)

    Thanks for that. And yes, I have been using the forms toolbar to create my macro buttons (hangover from using Excel 5), but it turns out the problem doesn't happen if I use the control tools.

    Cheers
    Neil Eustice
    Woody Worshipper

  4. #4
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Weert, Limburg, Netherlands
    Posts
    4,812
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: call code from another module (Excel 2000)

    Provided the sub names are unique, the module name can be left out.
    Jan Karel Pieterse
    Microsoft Excel MVP, WMVP
    www.jkp-ads.com
    Professional Office Developers Association

Posting Permissions

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