Silence the 'converted' msg when opening .docx's in 2003

M

Mark Tangard

Is there a way to bypass (or automatically answer OK to) the “file has
been converted to a format that you can work with” announcement when
opening a .docx file with Word 2003?

Our conversion is in progress but the job is massive, and in the
meantime it would help to not have to sit at the PC and answer OK when a
mixed assortment of (dozens or even hundreds of) .doc and .docx files
are sent through a batch-processing macro on the 2003 machines.

Is there a workaround or registry tweak or policy morph or.... yknow?

TIA.

MT
 
M

Mark Tangard

I know this question gets less urgent as the years wear on and fewer people use pre-2007 installations, and I also know it's unlikely to be Googled much. But I've found the answer at last (indirectly, via help from community star 'Andreas Killer' on the MS forums on a different but similar issue opening HTML files) and will share it here.

The secret lies in the fact that the conversion message is not an error -- which could be handled by fairly well-known code -- but an "alert." VBA has code to deal with alerts, but it doesn't seem to be discussed much online.

To have a pre-2007 version of Word open a .docx file in VBA without tripping over the conversion message, use a separate function rather than the Open method. Instead of this:

Set d = Documents.Open Filename:=fname

use this:

Set d = OpenXMLDoc(fname)

and in the same module, have this function:

Function OpenXMLDoc(ByVal Filename As String) As Document
'Opens docx file ignoring alerts
Dim SaveDisplayAlerts As wdAlertLevel
SaveDisplayAlerts = Application.DisplayAlerts
Application.DisplayAlerts = wdAlertsNone
On Error Resume Next
Set OpenXMLDoc = Documents.Open(Filename)
Application.DisplayAlerts = wdAlertsAll
End Function

I do wish I'd found this out sooner....

MT
 

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