[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

How to call a subroutine located in a different form

Posted on 2002-07-02
3
Medium Priority
?
180 Views
Last Modified: 2010-05-02
How can I call a subroutine that in a totally different form?
0
Comment
Question by:Draner
  • 2
3 Comments
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 7125674
the subroutine needs to be public and you call it this way:

FormName.SubRoutineName
0
 

Accepted Solution

by:
carlosferreira earned 200 total points
ID: 7125713
In the form which has the subroutine you want to call ensure that the subroutine is Public.  

eg.
Public Hello()
  MsgBox "Hello World"
End Sub

For sake of arguement also call this form "FormWithRoutine"

In the form you are calling from type the name of the Form with the subroutine, type a period, and the specify the name of the Routine you which to call.  In the example given above it would be:

FormWithRoutine.Hello
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 7125716
another newbie!!!

carlosferreira, your post is not an answer. You can read at the bottom of this screen :
"Answers
An answer is a specific solution to a question and should be submitted if it will solve the questioner's problem and doesn't duplicate a previous comment. "

Also, you made a mistake. It should be read: Public SUB Hello()
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question