README.md
December 4, 2022 ยท View on GitHub
Description
Custom MsgBox with many powerful
options as can be seen from 44 input arguments:
-
vPrompt - MessagBox prompt text
-
vTitle - MessagBox prompt text
-
vButton1 - caption of first button, if nil specified will be: OK
-
vButton2 - caption of second button
-
vButton1 - caption of third button
-
vButton1 - caption of fourth button
-
btDefault - sets what the default button is, so what button has focus on startup
-
lMessageIcon - set the MessageBox icon:
nil specified: no icon
1: Information
2: Question
3: Exclamation
4: Warning
- lFormColour - long value setting the BackColor of the MessageBox form, if nil specified will be the default VB MessageBox
colour. You can do black for example as the font will be set with a contrasting colour.
-
lLabelColour - long value setting the BackColor of the Prompt textbox, if nil specified will be same as lFormColour
-
lButtonColour - long value setting the BackColor of the buttons, if nil specified will be same as lFormColour
-
lLabelFontColour - long value setting the ForeColor of the Prompt textbox, if nil specified will be a contrasting colour
compared to the Prompt BackColor
-
lMaxLen - maximum number of characters in the Prompt text before a linebreak will occur, default 125
-
bPromptBorder - boolean, if True Prompt textbox will have a border
-
bIndentAfterBreak - boolean, if true there will be an indent after a linebreak in the prompt text.
-
bOnlyIndentWithNumericFirstChar - boolean only applies if bIndentAfterBreak is True. If bOnlyIndentWithNumericFirstChar
is True then then indent will only happen if the line started with a number.
-
strIndent - the indenting string
-
bStartLineWithSpacer - if True every new line in the Prompt will start with a spacing string. Useful when the Prompt
textbox has a border.
-
strSpacer - the spacer string, only applies if bStartLineWithSpacer is True
-
siPromptButtonFontSize - Single value, button font size, default is 10
-
lMinButtonWidth - long value, minimum button width, default is 1200
-
lMinButtonGap - Long value, minimum space between buttons, default is 150
-
lButtonEdge - Long value, minimum space between button edge and button caption, default is 150
-
bSpaceButtons - if True buttons will be spaced evenly between left and right border of Prompt textbox
-
bAdjustUnderlineStrings - if True this will make the string that comes after a specified linebreak the same length as the line above. This works if this underlining string is
or
, so 4 of these characters.
-
bShowTitleIcon - if True will show the title caption icon, default is True. Of course this icon can be changed.
-
bCenterPrompt - If True the text in the Prompt textbox will be centered
-
bInput - If True it will be an InputBox
-
vInputDefault - default InputBox value
-
bNumericInput - If True InputBox will only accept numeric input
-
bIntegerOnly - will only apply if bNumericInput is True. In that case only integer numbers will be allowed
-
vMinValue - will only apply if bNumericInput is True. Minimum allowed input value
-
vMaxValue - will only apply if bNumericInput is True. Maximum allowed input value
-
bBeep - Beep when the Msgbox loads
-
bLineUpTabs - if True tabs will be lined up in columns
-
strTabSpacer - string used to line up tabs, default is chr(32)
-
strTabSpacer - long value, minimum number of strTabSpacer characters to line up tabs
-
bAddTab - if True will add vbTab to spacer string, recommended to line up precisely
-
vTooltip1 - Tooltip text for button 1
-
vTooltip2 - Tooltip text for button 2
-
vTooltip3 - Tooltip text for button 3
-
vTooltip4 - Tooltip text for button 4
-
lActiveButtonColour - colour of the button that is moved over by the mouse
-
bReturnLineNumber - with a mouse right-click return the line number in the prompt where the cursor is, rather than the button caption.
More Info
44 optional arguments as explained
Included is a demo text file that holds a Sub demonstrating all features of this MsgBox.
Code geared up to use with Excel VBA, but can easily be altered to work with othet Office apps or VB.
Demo text file included with a Sub that demonstrates all options.
Caption of the pressed button or text of the input textbox or line number of the prompt box where the cursor is.
Nil that I am aware of.
| Submitted On | 2007-11-12 22:01:22 |
| By | RB Smissaert |
| Level | Intermediate |
| User Rating | 4.8 (29 globes from 6 users) |
| Compatibility | VB 6.0, VBA MS Access, VBA MS Excel |
| Category | Complete Applications |
| World | Visual Basic |
| Archive File | CustomMsgB20907511142007.zip |
API Declarations
Private Declare Function GetMenuItemCount Lib "user32" _
(ByVal hMenu As Long) As Long
Private Declare Function GetSystemMenu Lib "user32" _
(ByVal hwnd As Long, _
ByVal bRevert As Long) As Long
Private Declare Function RemoveMenu Lib "user32" _
(ByVal hMenu As Long, _
ByVal nPosition As Long, _
ByVal wFlags As Long) _
As Long
Private Declare Function LoadStandardIcon Lib "user32" _
Alias "LoadIconA" _
(ByVal hInstance As Long, _
ByVal lpIconNum As enStandardIconEnum) _
As Long
Private Declare Function DrawIcon Lib "user32" _
(ByVal hdc As Long, _
ByVal X As Long, _
ByVal Y As Long, _
ByVal hIcon As Long) As Long
Private Declare Function SetForegroundWindow _
Lib "user32" (ByVal hwnd As Long) As Long