Solved

How to call a subroutine located in a different form

Posted on 2002-07-02
3
169 Views
Last Modified: 2010-05-02
How can I call a subroutine that in a totally different form?
0
Comment
Question by:Draner
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 50 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

705 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