Userform Code vs Module Code

Discussion in 'AutoCAD' started by milfora, Jan 25, 2005.

  1. milfora

    milfora Guest

    I am pretty new to VBA, and am trying to wrap my head around the whole concept of userform vs module coding

    I have created a userform and coded the relative userform events. I have also created a module, and called a procedure to initialise the userform. Within this module, i have additional sub procedures for data processing.

    I would prefer to code in separate modules, and have them referenced by the main userform, however, I notice that when I go to run the macro, I get the option of running all the procedures (if they are declared public). When I change the sub procedures to 'Private', they cannot be reference from the userform code.

    Am I missing something here?
    Is it possible to have multiple sub procedures and modules within a program that are not contained within the userform code module, and are also hidden from the end user when they run the macro from the Visual Basic Manager?

    Thanks in advance

    AM
     
    milfora, Jan 25, 2005
    #1
  2. milfora

    ClementZheng Guest

    Declare them as "Public Function" in the module.
    They can be reference from userform, while the end user will never see them from VBA Manager or Macro.
     
    ClementZheng, Jan 25, 2005
    #2
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.