How to call a subroutine located in a different form

How can I call a subroutine that in a totally different form?
DranerAsked:
Who is Participating?
 
carlosferreiraConnect With a Mentor Commented:
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
 
Éric MoreauSenior .Net ConsultantCommented:
the subroutine needs to be public and you call it this way:

FormName.SubRoutineName
0
 
Éric MoreauSenior .Net ConsultantCommented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.