Command Failure

L

lhc

I receive a message "Command Failure" each time I attemp to use the following
code to close a document:

On Error GoTo errorHandler
ActiveDocument.Close _
SaveChanges:=wdPromptToSaveChanges, _
OriginalFormat:=wdPromptUser
errorHandler:
If Err = 4198 Then MsgBox "Document was not closed"

The code without the error handler under debug gives a "Command Failure"
message.
 
C

Cindy M.

Hi =?Utf-8?B?bGhj?=,
I receive a message "Command Failure" each time I attemp to use the following
code to close a document:

On Error GoTo errorHandler
ActiveDocument.Close _
SaveChanges:=wdPromptToSaveChanges, _
OriginalFormat:=wdPromptUser
errorHandler:
If Err = 4198 Then MsgBox "Document was not closed"

The code without the error handler under debug gives a "Command Failure"
message.
Is there a document open? If you use just ActiveDocument.Close (no parameters)
does that work?

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :)
 

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