Word "pops up" a message box occassionally.....

R

Robin Tucker

I'm automating report creation from VB.NET using Word VBA. During this
process, I need to embed links into the document at various places.
Sometimes, Word pops up a message box as follows:

Word is unable to create a link to the object you specified.
Please insert the object directly into your file without creating a
link.

This is all well and good (because sometimes the link *is* invalid!) but I
would rather be notified of it in my code than have Word pop up a message
box that must be responded to by the user. My report creation process is
supposed to go on in the background with Word "invisible", so obviously in
this case the user won't be able to respond to the message (err, I don't
even want the user to be able to do so!).

So my question to you is: Is there any way to prevent Word popping up this
message box and having my application handle the error instead?
 
P

Peter_A_M (NL)

Dear Robin,
In the past (and in different cases!) I've been successfully using the
following:

Application.DisplayAlerts = wdAlertsNone (or: wdAlertsMessageBox; see VBA
Help)

(Don't forget to place somewhere in your code:
Application.DisplayAlerts = wdAlertsAll
because otherwise, you won't get user interaction back!!)

In case of wdAlertsNone, automatically default options of messageboxes are
chosen.


I haven't the faintest idea if this is really a solution to your specific
problem, but you could give it a try!
Kind regards,
Peter
 

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