Message Box Font

T

Tom Ventouris

A2007.
Is there a way to change the size of the font on a message box?
I am looking for an alternative to creating a popup form for each message.
Thanks in advance for any help
 
A

Allen Browne

A custom popup form for each message?
Just create one form, and use it for all messages.

Pass the message in (say) OpenArgs, and in Form_Open assign it to the
unbound text box (or label Caption) to display the message.
 
T

Tom Ventouris

Thank you. A good suggestion which will take care of some messages, but many
have options for the users, (Yes, No, Ok, Cancel)
I am thinking of passing some value to a hidden field on the form and coding
the buttons to execute action depending on the hidden field value,
but this sounds like too much coding.

As a final option, I am buying the client reading glasses Monday morning. :)

Your reply was withdrawn(?) from my newsreader. I can see it on the group
site but cannot log on to reply.
Replying via newsreader, I hope it lands in the right place.
 
A

Allen Browne

Tom, it's not actually that hard to get this kind of form going.

You create a form with a text box (txtMsg), 4 command buttons (cmd1, cmd2,
cmd3, cmd4), and possibly 4 image controls (for critical, exclamation,
information, and question.) Set the form's properties, for popup and modal.

Create a function that opens the dialog, passing the information in
OpenArgs, like this:
docmd.OpenForm "fdlgMsgBox", WindowMode:=acDialog, _
OpenArgs:="Hello message, vbOk, My caption"

Then in the Open event of the form, parse OpenArgs into an array, and handle
each component. This kind of thing:

Private Sub Form_Open(Cancel As Integer)
Dim varArray As Variant
Dim iUbound As Integer
Dim lngMsgBoxStyle As Long

varArray = Split(Me.OpenArgs, ",")
If IsArray(varArray) Then
If iUbound >= 0 Then
If varArray(0) <> vbNullString Then
Me.txtMsg = varArray(0)
End If
If iUbound >= 1 Then
If IsNumeric(varArray(1)) Then
lngMsgBoxStyle = varArray(1)
'Figure out your buttons/image
Select Case (lngMsgBoxStyle And vbOK)
Case vbOK
With Me.cmd1
.Visible = True
.Caption = Ok
End With
Case vbOKCancel
With Me.cmd1
.Visible = True
.Caption = Ok
End With
With Me.cmd2
.Visible = True
.Caption = Cancel
End With
'etc
End Select
End If
End If
If iUbound >= 2 Then
If varArray(2) <> vbNullString Then
Me.Caption = varArray(2)
End If
End If
End If
End If
End If
End Sub
 
T

Tom Ventouris

Thanks Arvin
I also need Yes/No options for this one.
Your sample will help elsewhere.
 
T

Tom Ventouris

Thank you Allen.
It's not that hard any more. Thanks for an excellent start.
I'm done.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top