+ Reply to Thread
Results 1 to 6 of 6

Help calling a module from a button click

  1. #1
    Registered User
    Join Date
    02-20-2013
    Location
    New Cumberland
    MS-Off Ver
    Excel 2010
    Posts
    7

    Help calling a module from a button click

    Hey guys,

    I'm really new to VB and also to the this forum. So please excuse my ignorance. I tried searching for this but I couldn't find anything that would do what I was looking for. Anyways.

    I have 9 modules. Named OnePay through NinePay. On my spreadsheet I have a button. In the button I have the following code.

    Please Login or Register  to view this content.
    This doesn't work. I get "expected variable or proceedure, not module" error.

    What I would like to do is click the button, then have it ask me how many payments I want to create and call the module from there. Any help would be appreciated.

  2. #2
    Forum Expert p24leclerc's Avatar
    Join Date
    07-05-2010
    Location
    Québec
    MS-Off Ver
    Excel 2021
    Posts
    2,081

    Re: Help calling a module from a button click

    It should be like this (but I did not tried it)
    Please Login or Register  to view this content.
    Pierre Leclerc
    _______________________________________________________

    If you like the help you got,
    Click on the STAR "Add reputation" icon at the bottom.

  3. #3
    Registered User
    Join Date
    02-20-2013
    Location
    New Cumberland
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Help calling a module from a button click

    Hey Pierre, I tried the code that you suggested and it came up with the same error.

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    02-20-2013
    Location
    New Cumberland
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Help calling a module from a button click

    I actually figured it out. Even though my code was a little off "However I did try it that way before and several other ways.", I was able to figure it out. I was using an ActiveX button and not a form button. I don't understand why it won't work for an activeX button but it will a form button. Can anyone explain that to me please?

    Pierre, thank you so much for taking the time.

  5. #5
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Help calling a module from a button click

    The code will work for both types of button, the only real difference being where it's located.

    The code for a forms button will go in a standard module an an ActiveX button's code goes in a worksheet module.

    By the way, what do each of the subs you are calling do?

    Is each one completely different?
    If posting code please use code tags, see here.

  6. #6
    Registered User
    Join Date
    02-20-2013
    Location
    New Cumberland
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Help calling a module from a button click

    I have seperate modules...

    This would be an example of creating 8 payments. They are close to the same with the exception of adding another line of code.

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1