-
WSJanB
AskWoody LoungerWe are upgrading from Office 97 to Office 2003 too. We’ve developed a lot of “intelligent” templates in Word, which are dynamically built based on user choices, in dropdown formfields or with a commandbarbutton. That requires quite some VBA code, put in a single code-template that sits in the Word Startup directory. None of the other templates contains any code at all.
Loading the code-template in Word 2003 caused only a couple of problems and some minor inconveniences.
Word 97 VBA only has 1 event on application level that you can use to control opening documents by users: DocumentChange. This event fires whenever user creates or opens a document or changes to another document (menu Window). Loaded in Word 2003 the event-handling Sub wdApp_DocumentChange is run several (up to 32!) times before it triggered the rest of the code. And when you try to create a new document from a template, the event-handler goes into an endless loop… I haven’t found a reason, nor a solution / workaround for this. Apparently this event doesn’t work exactly the same as in Word 97. So I had to convert to 2 events which are not in Word 97 VBA: NewDocument and DocumentOpen. And that worked fine. But it means that I have to maintain 2 versions of my code template until our last user is upgraded to Office 2003.The second problem is hijacking menu entries and commandbar buttons the way it was done. If you do that properly (using the same name as the built-in Word command for your Sub) then you don’t have a problem. But unfortunately in the early days we didn’t know that and used dutch names for our own routines. And replaced the standard menu entries and commandbar buttons with ones that pointed to the Sub’s we created. Because the menubar in Word 2003 is organised differently, some entries showed up twice or even three times. So we decided to rename our Sub’s to match the built-in names and restore the original menubar and commandbar Standard.
Then there is this is strange behaviour of AutoText fragments that are saved with the template and placed in a document by VBA code. These fragments can contain both plain text and formfields. On some (!) PC’s the plain text was in Arial, as intended, but for the formfields the (ugly!) font MS Mincho was used. We can’t figure out why this happens. Eventually we decided to delete this font (present in both Windows XP and Office 2003 CAB files) from all PC’s. After that, Word used Arial Unicode MS for the formfields. But because there’s no visible difference with standard Arial, we can live with that.
The first mouseclick on a control in a dialog panel didn’t always do what you expect. It looks like the panel you just put on the screen (.Show) didn’t set the focus on the panel and that the first mouseclick just does set the focus on the panel. So you have to click again to fire the code behind the clicked control. We observed this both in Word XP (almost every time) and in Word 2003 (about fifty-fifty) when Windos XP Pro (dutch) and Office XP/2003 Enterprise Edition (dutch)were installed out-of-the-box. After a complete re-install of the PC’s, with all the latest patches for both Windows and Office applied, this problem seems to be solved. We never found out why it occurred in the first place.
Pagenumbering (page x of y) still is not perfect. At first we removed all code for updating the y-value because we thought that this was – finally – solved in Word XP / 2003. But in some cases we again encounterd document with the 1 of 1, 2 of 1, 3 of 1, etc. numbering. So we put the removed code back in…
The last issue I’d like to mention is that creating and opening documents takes more time in Word 2003 than it did in Word 97, up to 4x slower. These observations were made on a 2.53 Mhz Pentium 4 with 256 Mb memory and only Windows and Office installed.
Regards,
JanB -
WSJanB
AskWoody LoungerWord really doesn’t need pdf995 to mess up pagination…
Regards
JanB -
WSJanB
AskWoody LoungerWord really doesn’t need pdf995 to mess up pagination…
Regards
JanB -
WSJanB
AskWoody LoungerMarch 10, 2004 at 6:24 am in reply to: Template-specific menu items not appearing (Word 2003 (11, Build 5604)) #796971I have quit a few templates with specific commandbars attached, developed in Word 97. These all work as expected in Word 2003. In one template there are 2 items added to the Insert menu and these only show when a document based on that particular template is loaded. So I don’t have the problem you described.
> To make it appear, I have to go to “Tools… Customize”
It’s not clear to me if you do that in the document or in the template. It should be done in the template which is then saved again.
Regards,
Jan -
WSJanB
AskWoody LoungerMarch 10, 2004 at 6:24 am in reply to: Template-specific menu items not appearing (Word 2003 (11, Build 5604)) #796972I have quit a few templates with specific commandbars attached, developed in Word 97. These all work as expected in Word 2003. In one template there are 2 items added to the Insert menu and these only show when a document based on that particular template is loaded. So I don’t have the problem you described.
> To make it appear, I have to go to “Tools… Customize”
It’s not clear to me if you do that in the document or in the template. It should be done in the template which is then saved again.
Regards,
Jan -
WSJanB
AskWoody LoungerFebruary 23, 2004 at 11:08 am in reply to: Userform – Show contents on reopening document (Word 97) #788684Hi Kerry,
You could create a CustomDocumentProperty (CDP) for each element in the userform and save the content / status of the elements in the appropriate CDP after the user clicks a button on the userform that unloads / hides that form.
When (re)opening the file and calling the form again you could, in the form_Initialize routine, read the CDPs and populate the elements of the form with the saved content / status. (Of course you have to check first whether or not the CDPs exist.)Regards,
Jan -
WSJanB
AskWoody LoungerFebruary 23, 2004 at 11:08 am in reply to: Userform – Show contents on reopening document (Word 97) #788685Hi Kerry,
You could create a CustomDocumentProperty (CDP) for each element in the userform and save the content / status of the elements in the appropriate CDP after the user clicks a button on the userform that unloads / hides that form.
When (re)opening the file and calling the form again you could, in the form_Initialize routine, read the CDPs and populate the elements of the form with the saved content / status. (Of course you have to check first whether or not the CDPs exist.)Regards,
Jan -
WSJanB
AskWoody LoungerIf you do something in the code that “changes” (according to Excel) the file with the code, then you get prompted to save that file and therefore the password is needed. You can avoid that by adding a line of code that sets the Saved flag.
Personally I don’t have much experience with Excel VBA, but I suppose it’s not too different from Word VBA. So depending on the actual situation the line of code can be either:
ActiveWorkbook.Saved = True
Workbooks(i).Saved = True (i = indexnumber)
Workbooks(“name.xls”).Saved = True (replace with actual name of file)
etc.Place this line of code after the code that “changes” the file, or place it in an AutoClose Sub.
Regards,
Jan -
WSJanB
AskWoody LoungerIf you do something in the code that “changes” (according to Excel) the file with the code, then you get prompted to save that file and therefore the password is needed. You can avoid that by adding a line of code that sets the Saved flag.
Personally I don’t have much experience with Excel VBA, but I suppose it’s not too different from Word VBA. So depending on the actual situation the line of code can be either:
ActiveWorkbook.Saved = True
Workbooks(i).Saved = True (i = indexnumber)
Workbooks(“name.xls”).Saved = True (replace with actual name of file)
etc.Place this line of code after the code that “changes” the file, or place it in an AutoClose Sub.
Regards,
Jan -
WSJanB
AskWoody LoungerHi Hans, Porley
I had a wonderful long weekend!
Thanks Hans, for taking care of this.
I have one suggestion for the code to be more generic:Private Sub app_WindowSelectionChange(ByVal Sel As Selection)
If Sel.Information(wdActiveEndSectionNumber).ProtectedForForms = True And _
ActiveDocument.ProtectionType = wdNoProtection Then
ActiveDocument.Protect NoReset:=True, Type:=wdAllowOnlyFormFields
ElseIf Sel.Information(wdActiveEndSectionNumber).ProtectedForForms = False And _
ActiveDocument.ProtectionType = wdAllowOnlyFormFields Then
ActiveDocument.Unprotect
End If
End SubRegards,
Jan -
WSJanB
AskWoody LoungerHi Hans, Porley
I had a wonderful long weekend!
Thanks Hans, for taking care of this.
I have one suggestion for the code to be more generic:Private Sub app_WindowSelectionChange(ByVal Sel As Selection)
If Sel.Information(wdActiveEndSectionNumber).ProtectedForForms = True And _
ActiveDocument.ProtectionType = wdNoProtection Then
ActiveDocument.Protect NoReset:=True, Type:=wdAllowOnlyFormFields
ElseIf Sel.Information(wdActiveEndSectionNumber).ProtectedForForms = False And _
ActiveDocument.ProtectionType = wdAllowOnlyFormFields Then
ActiveDocument.Unprotect
End If
End SubRegards,
Jan -
WSJanB
AskWoody LoungerHans, Porley,
In a few minutes I’m leaving the office and have a very long weekend, returning tuesday or wednesday. If Porley cannot wait that long, and if the article I mentioned in my post 341104 in this thread isn’t clear enough to put things together, I hope Hans can help Porley out this time.
Regards,
JanB -
WSJanB
AskWoody LoungerHans, Porley,
In a few minutes I’m leaving the office and have a very long weekend, returning tuesday or wednesday. If Porley cannot wait that long, and if the article I mentioned in my post 341104 in this thread isn’t clear enough to put things together, I hope Hans can help Porley out this time.
Regards,
JanB -
WSJanB
AskWoody LoungerA good article on document and application events by Bill Coan, Take Control of Microsoft Word Through Events, can be found here.
JanB
-
WSJanB
AskWoody LoungerA good article on document and application events by Bill Coan, Take Control of Microsoft Word Through Events, can be found here.
JanB
![]() |
Patch reliability is unclear. Unless you have an immediate, pressing need to install a specific patch, don't do it. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |

Plus Membership
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Get Plus!
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Search Newsletters
Search Forums
View the Forum
Search for Topics
Recent Topics
-
Global data centers (AI) are driving a big increase in electricity demand
by
Kathy Stevens
2 hours ago -
Office apps read-only for family members
by
b
4 hours, 36 minutes ago -
Defunct domain for Microsoft account
by
CWBillow
1 hour, 28 minutes ago -
24H2??
by
CWBillow
10 hours, 20 minutes ago -
W11 23H2 April Updates threw ‘class not registered’
by
WindowsPersister
13 hours, 21 minutes ago -
Master patch listing for April 8th, 2025
by
Susan Bradley
6 hours, 35 minutes ago -
TotalAV safety warning popup
by
Theodore Nicholson
1 hour, 24 minutes ago -
two pages side by side land scape
by
marc
2 days, 2 hours ago -
Deleting obsolete OneNote notebooks
by
afillat
2 days, 4 hours ago -
Word/Outlook 2024 vs Dragon Professional 16
by
Kathy Stevens
1 day, 7 hours ago -
Security Essentials or Defender?
by
MalcolmP
1 day, 10 hours ago -
April 2025 updates out
by
Susan Bradley
5 hours, 6 minutes ago -
Framework to stop selling some PCs in the US due to new tariffs
by
Alex5723
1 day, 3 hours ago -
WARNING about Nvidia driver version 572.83 and 4000/5000 series cards
by
Bob99
17 hours, 33 minutes ago -
Creating an Index in Word 365
by
CWBillow
1 day, 20 hours ago -
Coming at Word 365 and Table of Contents
by
CWBillow
8 hours, 8 minutes ago -
Windows 11 Insider Preview Build 22635.5170 (23H2) released to BETA
by
joep517
2 days, 23 hours ago -
Has the Microsoft Account Sharing Problem Been Fixed?
by
jknauth
3 days, 2 hours ago -
W11 24H2 – Susan Bradley
by
G Pickerell
3 days, 4 hours ago -
7 tips to get the most out of Windows 11
by
Alex5723
3 days, 2 hours ago -
Using Office apps with non-Microsoft cloud services
by
Peter Deegan
2 days, 20 hours ago -
I installed Windows 11 24H2
by
Will Fastie
1 day, 2 hours ago -
NotifyIcons — Put that System tray to work!
by
Deanna McElveen
3 days, 8 hours ago -
Decisions to be made before moving to Windows 11
by
Susan Bradley
1 hour, 33 minutes ago -
Port of Seattle says ransomware breach impacts 90,000 people
by
Nibbled To Death By Ducks
3 days, 16 hours ago -
Looking for personal finance software with budgeting capabilities
by
cellsee6
3 days ago -
ATT/Yahoo Secure Mail Key
by
Lil88reb
3 days ago -
Devices with apps using sprotect.sys driver might stop responding
by
Alex5723
4 days, 9 hours ago -
Neowin – 20 times computers embarrassed themselves with public BSODs and goofups
by
EP
4 days, 18 hours ago -
Slow Down in Windows 10 performance after March 2025 updates ??
by
arbrich
17 hours, 33 minutes ago
Recent blog posts
Key Links
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.