Hi Tony,
You're precisely correct. I've now tried the same support.dot template in both
2003 and 2007, with and without pre-existing entries. When it runs from 2003,
the PrivateProfileString creates a REG_DWORD; when it runs from 2007, the same
code creates a REG_SZ. If there's a REG_DWORD there already, it's overwritten
with a REG_SZ.
When the value is a REG_DWORD, it works properly in both versions; when it's a
REG_SZ, the underline stays red. I suppose it's some consolation that Word
simply ignores a REG_SZ instead of throwing an exception. ;-)
I haven't been able to find any description on the web of this change in
PrivateProfileString's behavior (unless it's in one of the many non-English
items that Google turned up). Interestingly, the help for it has always said
that it writes a "string", so I guess it's a little surprising that it ever
wrote a DWORD.
The fix would have to involve use of the RegSetValueEx function of the Win32API,
which lets you specify the value's type; and that in turn would need
RegOpenKeyEx and RegCloseKey. It isn't terribly difficult if you're used to API
programming.
--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so all
may benefit.