Disabling Autosave from C++ in an automated Word Application

P

Pieter Morrison

Hi,
I've got an ActiveX control that automates Word and does some document
manipulation. If this control has a word document open, and Word
"Autosaves" or saves the auto-recovery information, Word itself crashes. So
I want to disable autosave while my activex control is running. I've got a
piece of VB code that does what I want, but I need to do this from C++
(using COleDispatchDriver wrappers generated from the Office type
libraries). Here is the VB code:

With Dialogs(wdDialogToolsOptionsSave)
.AutoSave = False
.Execute
End With

Now, in C++ I have the relevant Dialog box - and I can show it, but I need
to just change the value and save it..

Word10::Dialog optionsDialog = dialogs.Item(209); //
wdDialogToolsOptionsSave = 209

Does anybody know how to do this, or point me somewhere where I can find
out?

Thanks,

Pieter Morrison
 
C

Cindy M -WordMVP-

Hi Pieter,

Not sure which version of Word you're automating? But in any case, you should
be able to set the option directly, without going over the dialog box. In the
version I'm working in (2003), that would be
Application.Options.SaveInterval = 0
I've got an ActiveX control that automates Word and does some document
manipulation. If this control has a word document open, and Word
"Autosaves" or saves the auto-recovery information, Word itself crashes. So
I want to disable autosave while my activex control is running. I've got a
piece of VB code that does what I want, but I need to do this from C++
(using COleDispatchDriver wrappers generated from the Office type
libraries). Here is the VB code:

With Dialogs(wdDialogToolsOptionsSave)
.AutoSave = False
.Execute
End With

Now, in C++ I have the relevant Dialog box - and I can show it, but I need
to just change the value and save it..

Word10::Dialog optionsDialog = dialogs.Item(209); //
wdDialogToolsOptionsSave = 209

Does anybody know how to do this, or point me somewhere where I can find
out?

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Sep 30 2003)
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