Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 09-01-2018, 07:44 AM
Puzzled Programmer Puzzled Programmer is offline Problem with Msgbox in VBA Windows 10 Problem with Msgbox in VBA Office 2003
Novice
Problem with Msgbox in VBA
 
Join Date: Sep 2018
Posts: 3
Puzzled Programmer is on a distinguished road
Default Problem with Msgbox in VBA

I am trying to use a message box, but Excel won't accept a title




eg Msgbox("This is a test message",,"Test Message")

When I press Enter I get a message

Compile Error Expected: =

I am very puzzled.

It works correctly without a title eg
Msgbox("This is a test message")

Any thoughts........... and many thanks


Puzzled Programmer
Reply With Quote
  #2  
Old 09-01-2018, 07:55 AM
jeffreybrown jeffreybrown is offline Problem with Msgbox in VBA Windows Vista Problem with Msgbox in VBA Office 2007
Expert
 
Join Date: Apr 2016
Posts: 673
jeffreybrown has a spectacular aura aboutjeffreybrown has a spectacular aura about
Default

Take off the parenthesis...

Code:
Sub MessageBox()
    MsgBox "This is a test message", , "This is a Message"
End Sub
Please use code tags when posting code
Reply With Quote
  #3  
Old 09-01-2018, 08:05 AM
Puzzled Programmer Puzzled Programmer is offline Problem with Msgbox in VBA Windows 10 Problem with Msgbox in VBA Office 2003
Novice
Problem with Msgbox in VBA
 
Join Date: Sep 2018
Posts: 3
Puzzled Programmer is on a distinguished road
Default That doesn't work

I have already tried that

For instance


Msgbox("This is a test message",,Test Message) produces an error


Compile error
Expected: List separator or )


still puzzled... but thanks for your swift response
Reply With Quote
  #4  
Old 09-01-2018, 08:18 AM
jeffreybrown jeffreybrown is offline Problem with Msgbox in VBA Windows Vista Problem with Msgbox in VBA Office 2007
Expert
 
Join Date: Apr 2016
Posts: 673
jeffreybrown has a spectacular aura aboutjeffreybrown has a spectacular aura about
Default

Did you try exactly what I posted? I see you still have the parenthesis in your post #3.
Reply With Quote
  #5  
Old 09-01-2018, 08:32 AM
Puzzled Programmer Puzzled Programmer is offline Problem with Msgbox in VBA Windows 10 Problem with Msgbox in VBA Office 2003
Novice
Problem with Msgbox in VBA
 
Join Date: Sep 2018
Posts: 3
Puzzled Programmer is on a distinguished road
Default

Aha - sorry I misunderstood.


Eureka


Msgbox "This is a test message",,"Test message"


seems to work. Interesting, I have always included parentheses in Msgbox statements before, but as far as I remember this is the first time I have tried to put a title in as well.


Thanks for your help


Puzzled no longer
Reply With Quote
  #6  
Old 09-01-2018, 08:44 AM
jeffreybrown jeffreybrown is offline Problem with Msgbox in VBA Windows Vista Problem with Msgbox in VBA Office 2007
Expert
 
Join Date: Apr 2016
Posts: 673
jeffreybrown has a spectacular aura aboutjeffreybrown has a spectacular aura about
Default

You are very welcome. Happy to help in some small way and happy Exceling.
Reply With Quote
  #7  
Old 09-06-2018, 04:34 PM
trevorc trevorc is offline Problem with Msgbox in VBA Windows 7 32bit Problem with Msgbox in VBA Office 2013
Competent Performer
 
Join Date: Jan 2017
Posts: 174
trevorc will become famous soon enoughtrevorc will become famous soon enough
Default

This line as is expects an input from the messagebox to be returned to a variable Msgbox("This is a test message",,"Test Message")

This should work... T = Msgbox("This is a test message",,"Test Message")
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
msgbox when deleting cells Mikedk64 Excel Programming 11 07-13-2017 07:14 AM
Problem with Msgbox in VBA Trigger Beep or MsgBox when key combo accidentally pressed NotQuiteANovice Word VBA 1 04-07-2017 05:41 PM
Problem with Msgbox in VBA On Open MsgBox for use in Template sent out to colleagues to gather information Lancashire Lad Word VBA 2 10-26-2015 10:22 AM
Problem Sending Command to the Program - Office or Windows Problem ?? JosieNurse Office 0 04-21-2015 11:49 AM
Problem with Msgbox in VBA Make MsgBox appear... Jamtart PowerPoint 3 09-01-2012 08:21 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 10:43 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft