PDA

View Full Version : Solved: Keep common inputbox in background



mikke3141
04-30-2010, 01:23 PM
Userform UMsgBox

Private msTitle As String
Private msPrompt As String
Private mavButton As Variant
Private mlReturn As Long
Private Helpit As Integer

Property Get Title() As String
Title = msTitle
End Property

Property Let Title(aTitle As String)
msTitle = aTitle
End Property

Property Get Prompt() As String
Prompt = msPrompt
End Property

Property Let Prompt(aPrompt As String)
msPrompt = aPrompt
End Property
Property Get HelpType() As Variant
HelpType = Helpit
End Property

Property Let HelpType(aHelpit As Variant)
Helpit = aHelpit
End Property
Private Sub UserForm_Activate()
Dim i As Long
Me.Caption = msTitle
Me.lblPrompt = msPrompt
End Sub

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
If CloseMode = vbFormControlMenu Then
Cancel = True
End If
End Sub
Private Sub cmd1_Click()
Me.Hide
End Sub

Private Sub cmd2_Click()
Me.Hide
MsgBox "Help Code Raised is: " & Helpit
End
End Sub

Private Sub cmd3_Click()
Me.Hide
End
End Sub
and Module


Function CMsgBox(Optional ByVal sPrompt As String = "Microsoft Excel", _
Optional ByVal sTitle As String, Optional ByVal sHelp As String) As String

Load UMsgBox
UMsgBox.Title = sTitle
UMsgBox.Prompt = sPrompt
UMsgBox.HelpType = sHelp
UMsgBox.Show
CMsgBox = UMsgBox.tbo.Value
Unload UMsgBox

End Function

Sub CreateCustomMsg()

Dim lResp As String

lResp = CMsgBox("Is this what you want?", _
"What do you want?", 10010)
MsgBox "Request: " & lResp

End Sub

My problem is when I 'Private Sub cmd2_Click()' and initiate my help file, I would like to stop the MsgBox from popping up in the module stating 'Request:...' What is the best way solving this issue. I could use 'end' but I want to have the userform still active and open when I close my helpfile.