Floating messag ebox

P

Prasant

Hi

I am using Word 2007

I have a message box in one macro which I want to make it float so that I
can work on the document with the dialog box open, like find and replace or
marking entries dialog boxes. Presently the message box is not giving access
to edit the document. I need both message box on the top of the document but
with access to the editing. Please help.

Thanks
 
J

Jay Freedman

What you're asking for is a "nonmodal" box, one that stays on screen while
the user continues to edit. An ordinary MsgBox can't do that, but a userform
can.

Design a userform that looks like a message box, with just a label and one
or more buttons (see http://gregmaxey.mvps.org/Custom_MsgBox.htm).

Call the userform from your macro like this:

Dim dlg As frmNonModalMsg
Set dlg = New frmNonModalMsg
dlg.Show vbModeless
' do some stuff here
Set dlg = Nothing

The vbModeless parameter in the .Show method makes the userform nonmodal;
the rest of the macro continues to run, and the user has access to all the
text and controls in the document.

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 

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