Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Name of Calling Procedure

Status
Not open for further replies.

Igwiz

Technical User
Jun 3, 2003
88
0
0
CA
Hi,

I want to use a generic user form called from several menu items. Basically it allows the user to chose whether the macro should be run on one dataset on another.

My question is, obviousy depending which macro called the userform, different follow on calls will be required so - how can I reference which procedure called the userform in order to do an IF or SELECT statement?

Many thanks,

Ig
 
Hi,

You could try some thing like this:

Public gstrTheName As String
Sub OpenUserByMe()
gstrTheName = "It's me"
UserForm1.Show
End Sub

Sub openUserByHim()
gstrTheName = " No, It's him"
UserForm1.Show
End Sub

And in the Initialize of your form read strTheName


Jean-Paul
Montreal
jp@solutionsvba.com
mtljp2@sympatico.ca
 
Sounds good. And how whould I ready the strTheName?
 
Hi

In the initialize event of the user form, like that:

Private Sub UserForm_Initialize()
Select Case gstrTheName
Case "It's me"
'have some holidays
Case "No, It's him"
' have him do some thing
End Select
End Sub


Jean-Paul
Montreal
jp@solutionsvba.com
mtljp2@sympatico.ca
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top