Is there a way to display a message on a frame without the msgbox in VBA?

excel_sat

New Member
Joined
Jun 10, 2015
Messages
22
Hi All,

Iam wondering.. is there a way to display just the message without the msgbox (preferably on a frame :)) so that the user will just view the message and don't need to close the message like it happens with msgbox?

Ps: formatting of the text displayed would be good too...
 
Hi excel_sat,

If you use the following code to create your message box it will automatically close after the pre-defined amount of time.

Rich (BB code):
Sub MessageBoxTimer()
    Dim AckTime As Integer, InfoBox As Object
    Set InfoBox = CreateObject("WScript.Shell")
    'Set the message box to close after X seconds
    AckTime = 10
    Select Case InfoBox.Popup("Click OK (this window closes automatically after 10 seconds).", _
    AckTime, "This is your Message Box", 0)
        Case 1, -1
            Exit Sub
    End Select
End Sub
You can change the bold AckTime = 10 to however many seconds you want the box open for.
You can change the bold "This is your Message Box" to whatever you want the message to read.
I hope this helps.
 
Upvote 0
Hi excel_sat,

If you use the following code to create your message box it will automatically close after the pre-defined amount of time.

Rich (BB code):
Sub MessageBoxTimer()
    Dim AckTime As Integer, InfoBox As Object
    Set InfoBox = CreateObject("WScript.Shell")
    'Set the message box to close after X seconds
    AckTime = 10
    Select Case InfoBox.Popup("Click OK (this window closes automatically after 10 seconds).", _
    AckTime, "This is your Message Box", 0)
        Case 1, -1
            Exit Sub
    End Select
End Sub
You can change the bold AckTime = 10 to however many seconds you want the box open for.
You can change the bold "This is your Message Box" to whatever you want the message to read.
I hope this helps.
D'oh!

CORRECTION:


The bold "This is your message box" is in fact the title at the top of the msgbox.
The bold "Click OK (this window closes automatically after 10 seconds)." can be changed to whatever you want your message to read.

Sorry for the confusion.
 
Upvote 0
Thanks for taking out time to reply but i want the message "no records found" to be just shown at the bottom of a userform where there is a frame and couple of other controls not in a msgbox.
Is that possible?
 
Upvote 0
Thanks for taking out time to reply but i want the message "no records found" to be just shown at the bottom of a userform where there is a frame and couple of other controls not in a msgbox.
Is that possible?
Hi again excel_sat,

To be honest my knowledge of such things is somewhat limited. If my initial suggestion is not what you need you may need to wait for someone else to pick up the query for you I am afraid.

Sorry I couldn't be of more help.
 
Upvote 0
This type of thing may help. You need to make sure all names of the objects are correct or it will error:

Code:
Sub openForm()

Dim sh As Worksheet

Set sh = Sheets("Sheet1")

With UserForm1.Label1
    .Caption = "Write message here"
    .Font = sh.Range("A1").Font.Name
    .Font.Size = sh.Range("A1").Font.Size
End With

UserForm1.Show

End Sub
 
Upvote 0

Forum statistics

Threads
1,226,835
Messages
6,193,228
Members
453,781
Latest member
Buzby

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