PDA

View Full Version : Custom Msgbox



av8tordude
06-04-2011, 02:06 PM
Is it possible to create a custom msgbox as pictured in the attached.

For Example:

If the user enters the PerDiem Rate, the word "PerDiem Rate" will not appear in the msgbox, but if the user does not enter the other two requirements, the other two requirements still appear in the msbox

mikerickson
06-04-2011, 02:12 PM
Perhaps something like this. This assumes that you have three numeric variables perDiemRate, RateReduction and TaxRate.


Dim messagePrompt As String

messagePrompt = "You must enter:" & vbCr

If perDiemRate = 0 Then
messagePrompt = messagePrompt & vbCr & vbTab & vbTab & "Per Diem Rate"
End If

If RateReduction = 0 Then
messagePrompt = messagePrompt & vbCr & vbTab & vbTab & "Rate Reduction"
End If

If TaxRate = 0 Then
messagePrompt = messagePrompt & vbCr & vbTab & vbTab & "Tax Rate"
End If

If messagePrompt <> ("You must enter:" & vbCr) Then
MsgBox messagePrompt
End If

av8tordude
06-04-2011, 02:40 PM
Out of curiosity, I was talking about change a normal msgbox into a custom msgbox. Is this code for a custom-made msgbox userform?

mikerickson
06-04-2011, 03:33 PM
That code is for a standard MsgBox. The only customization allowed for a standard MsgBox is the text, which that code does, and the buttons.

If you are looking to customize an InputBox, so that the user selects the category (Per Diem, Reduction or Tax) and enters the value....the only thing I can think of would be a bit clunky.

Neither the MsgBox or the InputBox are customizable to any great degree.