Z
z
I've found that it's the userforms, not the code, that
takes up a lot of space. It sounds like you can reuse the
same userform a few times and just pass in the labels,
prompts, etc. The code below is for a two-button userform
and is placed in the userform itself
Public Function GetResponse() As Integer
'This subroutine simply determines which option was
checked,
'sends the value back to the calling routine, and unloads
the
'dialog box to free memory.
If OptnBtn1.Value = True Then
GetResponse = 1
ElseIf OptnBtn2.Value = True Then
GetResponse = 2
Else
GetResponse = 0
End If
Unload frm2Btns
End Function
The calling program uses the following text to get the
user's response:
With frm2Btns
.Caption = "your caption"
.Label1.Caption = "Label 1 text"
.OptnBtn1.Caption = "Option button 1 prompt"
.OptnBtn2.Caption = "Option button 2 prompt"
End With
Load frm2Btns
frm2Btns.Show
UserResponse = frm2Btns.GetResponse
Unload frm2Btns
Select Case UserResponse
Case 0
[your code]
Case 1
[your code]
Case 2
[your code]
End Select
Hope this helps.
takes up a lot of space. It sounds like you can reuse the
same userform a few times and just pass in the labels,
prompts, etc. The code below is for a two-button userform
and is placed in the userform itself
Public Function GetResponse() As Integer
'This subroutine simply determines which option was
checked,
'sends the value back to the calling routine, and unloads
the
'dialog box to free memory.
If OptnBtn1.Value = True Then
GetResponse = 1
ElseIf OptnBtn2.Value = True Then
GetResponse = 2
Else
GetResponse = 0
End If
Unload frm2Btns
End Function
The calling program uses the following text to get the
user's response:
With frm2Btns
.Caption = "your caption"
.Label1.Caption = "Label 1 text"
.OptnBtn1.Caption = "Option button 1 prompt"
.OptnBtn2.Caption = "Option button 2 prompt"
End With
Load frm2Btns
frm2Btns.Show
UserResponse = frm2Btns.GetResponse
Unload frm2Btns
Select Case UserResponse
Case 0
[your code]
Case 1
[your code]
Case 2
[your code]
End Select
Hope this helps.