I have a routine which opens a word document, saves it as text and
closes the word document.
I detect if word was previously open, if it is I leave it open and
load my document. The SaveAs command forces a "The document may
contain text content which will be lost on upon conversion...Continue
with Save?" dialog. So far I have found no way of eliminating this
dialog.
If word is not previously open then this dialog doesn't appear and the
process can run independently on hundreds of files (which it needs to
do).
HELP, what can I do to eliminate this dialog without forcing word to
close and open for every document?
This project is being written in VB6 for Word 9 and above. The Word
Object Libraries are referenced.
michael stewart
mstewart@lifelearn.com
Ed - 29 Nov 2004 18:19 GMT
You might try
Application.DisplayAlerts = wdAlertsNone
and
Application.DisplayAlerts = wdAlertsAll
using your object handle for Word in place of "Application".
Ed
> I have a routine which opens a word document, saves it as text and
> closes the word document.
[quoted text clipped - 17 lines]
> michael stewart
> mstewart@lifelearn.com
Jezebel - 29 Nov 2004 20:39 GMT
There must be something else going on. The SaveAs command isn't directly
affected by how Word is instantiated.
> I have a routine which opens a word document, saves it as text and
> closes the word document.
[quoted text clipped - 17 lines]
> michael stewart
> mstewart@lifelearn.com
Helmut Weber - 30 Nov 2004 05:08 GMT
Hi Mike,
I don't know, what this got to do with whether Word was previously
open or not. This is how I avoid the message in question:
Public Sub SaveAsTxt()
Dim sName As String
With ActiveDocument
sName = .FullName
sName = Left(sName, Len(sName) - 4) & ".txt"
.SaveAs _
FileName:=sName, _
FileFormat:=wdFormatText
.SaveAs FileName:="c:\tmp.doc", _
FileFormat:=vbNormal
.Close
End With
End Sub
"c:\tmp.doc" will be overwritten without asking.
---
Greetings from Bavaria, Germany
Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word XP, Win 98
http://word.mvps.org/