What is the Font and Font Size used inside a standard MsgBox
dialog in VBA for Excel?
When I search for that here in S.O. I am not seeing anything useful, and certainly not the answer to this specific question. The bulk of the questions/answers all revolve around generating a custom user form with whatever font a user wants because a user wants a custom dialog with a different size. . .
I'm specifically trying to find what Font/Size is used on the standard MsgBox
so I can create a custom form which matches the same Font/Size of a standard MsgBox
but this answer eludes me . . .
I have seen it referenced as "The Windows Default Font" . . . if this is the case, where do I find it, and can it be programmatically referenced in VBA? I'm sure this may change from user to user. It appears on my system to be Tahoma
size 8
, but even this does not match exact, and this may not be the same as everyone else's PC. . . Also, I'm only guessing by painstakingly matching it one step at a time.
I have tried looking under Application
which does not provide any Font
Class, and Windows
just gives me the options for the Application.Windows
Class.
If this is a duplicate question and this has already been asked, please point me to it and I will gladly peruse it.
Update: I'm looking into the Win32 API's based on this SO article and have found some options pointing to the message fonts (as suggested by the comment to this question) and am developing something like the following. Am I close?
Public Declare PtrSafe Function SystemParametersInfo Lib "user32" Alias "SystemParametersInfoA" (ByVal uAction As Long) As Long
Const SPI_GETNONCLIENTMETRICS as long= &H29
'Not sure if the SystemParameterInfo Function requires Hex or Decimal value for NONCLIENTMETRICS construct.
'Const SPI_GETNONCLIENTMETRICS as long = 41
Then my next question is how to point to the lfMessagefont
type from the
NONCLIENTMETRICS
construct to obtain that LOGFONT
data. . . Microsoft docs don't specify in ways that are making sense to me . . . yet.
NONCLIENTMETRICSA Structure LOGFONTA Structure
As "Cool" as it would be. . . I'm starting to believe it'll be MUCH simpler just to make a custom form as everyone else does. . .