'Changes made to Normal.dot' message in Word 2000 via Automation

E

Evan Stone

Hi,

The next interesting thing I'm finding (among others) is that Word 2000
seems to produce the following message on its first run: "Changes have been
made that affect the global template, Normal.dot. Do you want to save those
changes?" and then it produces a Save As dialog.

Office 2000 was just installed on this machine running WinXP SP1, after
having Office 2003 uninstalled.

So now I'm wondering two things:

1. Why does the message get displayed when I'm not
modifying any documents at the time at which the error
message appears.*

2. Is this something I should be overly concerned with
(i.e. will I see this often)?

Thanks in Advance!

evan stone | software engineer
----------------------------------------
santa rosa, ca, usa

* There are two methods that I've created that I use at my application's
launch that I use to determine: a) if Word is installed, and if it is, then
it b) get its version. The methods do NOT open an existing or create a new
document. They merely do those operations and then Quit. However, if it
would be useful to see the code I'm using (it's LATE BOUND C# code), I can
post the functions -- perhaps I'm not including a parameter I should be
including or something along those lines...
 
E

Evan Stone

(it's LATE BOUND C# code)

I just thought I'd mention that I also have some early-bound code that seems
to work OK and does not evoke the same weird behavior from Word. However,
I'm experiencing other strange behavior from retrograding to Office 2000 (9)
DLLs that I created yesterday.
 
C

Cindy M -WordMVP-

Hi Evan,

If the message you're reporting is the one I think it is, this is standard
behavior. If anything is done in the UI that would store in Normal.dot (for
example: create AutoText, formatted AutoCorrect, Keybindings,
Toolbars/buttons, macros), Normal.dot has to be saved.

The message you're seeing reflects this PLUS that the option to prompt about
saving changes to Normal.dot is active in Tools/Options/Save. Your code can
turn this option off. Or it can save the changes "silently"
(NormalTemplate.Save). Or you can make sure that nothing is saved by setting
NormalTemplate.Saved = True before quitting.
The next interesting thing I'm finding (among others) is that Word 2000
seems to produce the following message on its first run: "Changes have been
made that affect the global template, Normal.dot. Do you want to save those
changes?" and then it produces a Save As dialog.

Office 2000 was just installed on this machine running WinXP SP1, after
having Office 2003 uninstalled.

So now I'm wondering two things:

1. Why does the message get displayed when I'm not
modifying any documents at the time at which the error
message appears.*

2. Is this something I should be overly concerned with
(i.e. will I see this often)?

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
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 :)
 
E

Evan Stone

If the message you're reporting is the one I think it is, this is standard
behavior. If anything is done in the UI that would store in Normal.dot (for
example: create AutoText, formatted AutoCorrect, Keybindings,
Toolbars/buttons, macros), Normal.dot has to be saved.

Actually, it's weirder, but perhaps you can tell what the problem is by
looking at the code:

//------------ begin -------------
private static readonly Type WordType =
Type.GetTypeFromProgID("Word.Application");

private AppInstallation Installed()
{
// Quick test to determine if Word is installed,
// and return version.
object[] parameter = new object[1];
object wordObject;

// assume it's installed (90% case)
AppInstallation installed = AppInstallation.Installed;

try
{
// just like in the Version method, we're doing this through
// late binding, since we don't know what they've got installed
// (if anything). This will just help bridge the gap.

//Create instance of word
wordObject = Activator.CreateInstance(WordType);
if (wordObject != null)
{
WordType.InvokeMember("Quit",
BindingFlags.DeclaredOnly |
BindingFlags.Public | BindingFlags.NonPublic |
BindingFlags.Instance | BindingFlags.InvokeMethod,
null, wordObject, null);
}

}
catch(Exception ex)
{
Log.Error("Installed", ex);
installed = AppInstallation.NotInstalled;
}

return installed;
}

private string Version()
{
// Quick test to determine if Word is installed, and return version.
//Type word;
object[] parameter = new object[1];
object wordObject;
string version = "";

try
{

//Create instance of word
wordObject = Activator.CreateInstance(WordType);
if (wordObject != null)
{
parameter[0] = true;

//get the Version property
version = (string) WordType.InvokeMember("Version",
BindingFlags.DeclaredOnly | BindingFlags.Public |
BindingFlags.NonPublic |
BindingFlags.Instance | BindingFlags.GetProperty,
null, wordObject, null);

// close the application
WordType.InvokeMember("Quit",
BindingFlags.DeclaredOnly |
BindingFlags.Public | BindingFlags.NonPublic |
BindingFlags.Instance | BindingFlags.InvokeMethod,
null, wordObject, null);
}

}
catch(Exception ex)
{
Log.Error("Version", ex);
version = string.Empty;
}

return version;
}
//------------ end -------------

These are the only to methods that are called when the Normal.dot message
appears, and I'm not modifying anything (documents or application
properties)...

So I'm curious as to what's causing it.

-evan
 

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