Restore Office State

W

wsmerek_MCAD

Hey Everybody,

I run Excel and Word automation-based document viewers in my VB program.
Some operations result in residual changes to the user's desktop Office
settings. I would like to leave Office the way I found it. Is there a nice
clean way to iterate through the settings for Word & Excel and persist them
for later restore? This would be very nice for development, where I am
constantly trashing my Office App UIs because of good testing scenarios gone
bad. Any thoughts appreciated.

Walter
 
C

Cindy Meister

Hi Walter

Well, as far as Word is concerned, there are two places these things are
usually stored:
- the Normal.dot template
- the DATA key in the Registry (under the Word entry)

Theoretically, you could certainly backup and restore the Data key.
Normal.dot is trickier, because you can't do anything with it if Word is
running on the system - that should lock the file. OTOH, if your app is
making these kinds of changes, you could be saving the original settings and
restoring them later...
 
W

wsmerek_MCAD

Thanks Cindy,

I think I was hoping for a nice WordApp.Settings.ToXML method I could use
with it's trusty counterpart WordApp.Settings.FromXML for reloading. We're
doing a good job of restoring the environment for the most part. It just
gets sticky when we're in Full window, no menus or toolbars viewing mode and
something locks up. Try to send someone an e-mail, and your editor is out of
contol. For Excel, we actually had to write a program to open the automation
server and restore some kind of order before you can use the program. For
many years I never conducted office communications activities on my dev box,
but I thought those days were over. Right now I need to manipulate print
areas in Excel to acomodate any Excel document, regardless of macros,
protections, or other embedded goodies. I suppose the answer is to just do
what you have to do, and then undo it. Thanks for your help.

Walter
 

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