Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Identify which button called the userform

I have 3 userforms (frmCC, frmEC, & frmPC) that have a particular button
Named "btnReveals". This button calls another userform named "frmReveals".
How can I identify which of the 3 userforms (frmCC, frmEC, & frmPC) have
called frmReveals?

For example, if frmCC calls frmReveals, I want to disable some controls on
frmReveals. If frmPC calls frmReveals, I want to disable a differenct set of
controls.

This is what I had in mind:

' frmReveals
Private Sub UserForm_Initialize()

' disable contols on Reveals userform depending on which button calls it
Select Case Application.Caller

Case Is = "Button 178" ' frmCC button
' disable non applicable reveal controls

Case Is = "Button 179" ' frmEC button
' disable non applicable reveal controls

Case Is = "Button 180" ' frmPC button
' disable non applicable reveal controls

End Sub

Thanks for your help in Advance!
--
Cheers,
Ryan
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Identify which button called the userform

I'd create a public variable in a General module (not in any userform module)
and just set it before you load the frmReveals userform

Public WhichFrmName as string

....

In the 3 different forms button click event

whichfrmname = me.name
me.hide '???
frmreveals.show

then I could use whichfrmname in the _initialize event of frmreveals.


RyanH wrote:

I have 3 userforms (frmCC, frmEC, & frmPC) that have a particular button
Named "btnReveals". This button calls another userform named "frmReveals".
How can I identify which of the 3 userforms (frmCC, frmEC, & frmPC) have
called frmReveals?

For example, if frmCC calls frmReveals, I want to disable some controls on
frmReveals. If frmPC calls frmReveals, I want to disable a differenct set of
controls.

This is what I had in mind:

' frmReveals
Private Sub UserForm_Initialize()

' disable contols on Reveals userform depending on which button calls it
Select Case Application.Caller

Case Is = "Button 178" ' frmCC button
' disable non applicable reveal controls

Case Is = "Button 179" ' frmEC button
' disable non applicable reveal controls

Case Is = "Button 180" ' frmPC button
' disable non applicable reveal controls

End Sub

Thanks for your help in Advance!
--
Cheers,
Ryan


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Private Sub - Called from Userform pallaver Excel Discussion (Misc queries) 3 July 15th 08 08:41 AM
Retaining Values in Userform when called a second time ExcelMonkey Excel Programming 2 May 3rd 07 03:55 PM
User Defined Function - Can we identify the cell it's called from Barb Reinhardt Excel Programming 5 March 21st 07 09:17 PM
Passing a value from 1 userform to another when you dont know who called it. [email protected] Excel Programming 2 August 25th 06 04:11 PM
Why does this code not create a button when called??? Simon Lloyd[_532_] Excel Programming 3 August 16th 04 02:31 AM


All times are GMT +1. The time now is 11:02 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"