Display MsbBox in Word using Excel VBA

G

Guest

Hi,
I would like to make a popup (msgbox) in word using Excel VBA.
Any idea ?
something like..
Set appWord = New Word.Application
appWord.MsbBox = "Report created"
Thanks!
Alex
 
J

Jon Peltier

You probably want the messagebox in the same Word instance which contains
the report, assuming that's why you're using Word.

Earlier in the routine you probably have one of these:

Set appWord = New Word.Application
Set appWord = CreateObject("Word.Application")
Set appWord = GetObject(, "Word.Application")

and then you create the report within appWord. Don't kill appWord until
after you've executed this line:

appWord.MsgBox "Report created", vbExclamation, "Message"

- Jon
 
G

Guest

Hi Jon,

When I try to write appWord.* , I don't have MsgBox choice and it doesn't
work if I write it ? appWord.Application.MsgBox doesn't work too. I seems
that msgbox is in class interaction. Do you have an other idea?
Thanks!
Alex
Set appWord = New Word.Application
appWord.Visible = True
Set MyDocWord = appWord.Documents.Add
 
D

Dave Peterson

I searched the excel newsgroups for "msgbox word" and found this hit from
Orlando Magalhães Filho.

http://groups.google.co.uk/group/mi...e5d951282a6?lnk=st&q=&rnum=4#4a3dbe5d951282a6

or

http://snipurl.com/1dfpi

========

Sub MsgBoxOverWord()
Dim WordApp As Object
Set WordApp = CreateObject("word.application")
With WordApp
.Visible = True
.Documents.Add
WordApp.WordBasic.MsgBox "Hi!", 1
.Quit
End With
End Sub

Harald Staff added a link to show how to use an API call to put the message box
atop any application.
 
D

Dave Peterson

ps. That worked for me in xl2003.
Hi,
I would like to make a popup (msgbox) in word using Excel VBA.
Any idea ?
something like..
Set appWord = New Word.Application
appWord.MsbBox = "Report created"
Thanks!
Alex
 
J

Jon Peltier

You could either follow up on Dave's suggestions, or just use

MsgBox "Report created", vbExclamation, "Message"

- Jon
 
G

Guest

Thanks!!

Dave's suggesion is working good. Word 2002 recognize
appWord.WordBasic.MsgBox "Hi!"
 

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