Not your ordinary error messages

JPM

Active Member
Joined
Aug 1, 2002
Messages
407
For your enjoyment:

Code:
Sub ErrMsg() 'Created by JPM

Name1 = Application.UserName
Where1 = Application.WorksheetFunction.Find(" ", Name1) - 1
Name2 = Left(Name1, Where1)

Dim Msg(1 To 10)
Msg(1) = Name2 & ", you created an error that your Version of Excel does not support." & vbLf & "However in Excel's next version it's considered a feature."
Msg(2) = Name1 & ", this was a really dumb move on your part." & vbLf & "Please don't do that again."
Msg(3) = Name2 & ", why did you do that?" & vbLf & "Didn't you learn from the last time?"
Msg(4) = Name1 & ", you have just triggered a Network Windows Alert," & vbLf & "demonstrating your lack of skill working with this application " & vbLf & "even after all this time."
Msg(5) = Name2 & ", " & Name1 & ", you have just caused a lethal error." & vbLf & "I am afraid you might have to be terminated."
Msg(6) = Name1 & ", this is it!" & vbLf & "The ultimate error!" & vbLf & "You might as well go home now."
Msg(7) = Name2 & ", that didn't work!" & vbLf & "Now please smash your forehead on the keyboard to continue."
Msg(8) = Name1 & ", this will end your Windows session." & vbLf & "Do you want to play another game?"
Msg(9) = Name2 & ", you have created Runtime Error 6D at 417A:32CF:" & vbLf & "Incompetent User."
Msg(10) = Name1 & ", this error is relatively bad." & vbLf & "You might have a one-bit brain with a parity error."

Style = vbCritical

Dim Title(1 To 10)
Title(1) = "Error 1.1"
Title(2) = "Error 123"
Title(3) = "Error 101"
Title(4) = "Error 999"
Title(5) = "Error 007"
Title(6) = "Error 666"
Title(7) = "Error 400"
Title(8) = "Error ˜"
Title(9) = "Error 000"
Title(10) = "Error E+MC"

n = Int((10 * Rnd) + 1)
MsgBox (Msg(n)), Style, (Title(n))
End Sub

This piece of code will randomly display one of the 10 messages.
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.

Forum statistics

Threads
1,222,759
Messages
6,168,052
Members
452,160
Latest member
Bekerinik

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top