Silence "continue with save" prompt

M

Mike Stewart

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
(e-mail address removed)
 
E

Ed

You might try
Application.DisplayAlerts = wdAlertsNone
and
Application.DisplayAlerts = wdAlertsAll
using your object handle for Word in place of "Application".

Ed
 
J

Jezebel

There must be something else going on. The SaveAs command isn't directly
affected by how Word is instantiated.
 
H

Helmut Weber

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/
 

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