-
WSJanB
AskWoody LoungerJefferson,
Thanks for the URL to a interesting post.
JanB
-
WSJanB
AskWoody LoungerJefferson,
Thanks for the URL to a interesting post.
JanB
-
WSJanB
AskWoody LoungerHans,
If Porley likes the idea, I’ll do that. And thanks for spreadsheet URL !
JanB
-
WSJanB
AskWoody LoungerHans,
If Porley likes the idea, I’ll do that. And thanks for spreadsheet URL !
JanB
-
WSJanB
AskWoody LoungerHans, and Porley of course,
I found out something quite interesting. I’m experimenting with Office 2003 (Dutch version) a bit because we are considering upgrading from Office 97. In Word 97 VBA there is only 1 event on application level that you can use: DocumentChange. But in Word 2003 VBA there are a lot more. One of them is WindowSelectionChange and that gave me an idea.
I created a document with 2 sections, marked section 1 as protected and section 2 as unprotected and then protected the document for forms.
In a properly declared class module I put this code:Public WithEvents wdApp As Word.Application
Private Sub WindowSelectionChange(ByVal Sel As Selection)
If Sel.Information(wdActiveEndSectionNumber) = 1 Then
ActiveDocument.Protect NoReset:=True, Type:=wdAllowOnlyFormFields
Else
ActiveDocument.Unprotect
End If
End SubIf I click, or move the cursor with the arrow keys in the unprotected Section 2, then the whole document is unprotected. And clicking, or moving the cursor with the arrow keys into Section 1 protects the whole document again, disabling the possibility to enter tekst in that section…
I just found out, so I’m not sure of all the drawbacks and ramifications yet, but it sure has some perspective!I don’t know of these extra events are already present in Word 2000 VBA, but I heard from a co-worker that there are more than 1 in Word XP. Because I dont have that version here, I cannot tell if this particular event is present and my code is working in Word XP.
JanB
-
WSJanB
AskWoody LoungerHans, and Porley of course,
I found out something quite interesting. I’m experimenting with Office 2003 (Dutch version) a bit because we are considering upgrading from Office 97. In Word 97 VBA there is only 1 event on application level that you can use: DocumentChange. But in Word 2003 VBA there are a lot more. One of them is WindowSelectionChange and that gave me an idea.
I created a document with 2 sections, marked section 1 as protected and section 2 as unprotected and then protected the document for forms.
In a properly declared class module I put this code:Public WithEvents wdApp As Word.Application
Private Sub WindowSelectionChange(ByVal Sel As Selection)
If Sel.Information(wdActiveEndSectionNumber) = 1 Then
ActiveDocument.Protect NoReset:=True, Type:=wdAllowOnlyFormFields
Else
ActiveDocument.Unprotect
End If
End SubIf I click, or move the cursor with the arrow keys in the unprotected Section 2, then the whole document is unprotected. And clicking, or moving the cursor with the arrow keys into Section 1 protects the whole document again, disabling the possibility to enter tekst in that section…
I just found out, so I’m not sure of all the drawbacks and ramifications yet, but it sure has some perspective!I don’t know of these extra events are already present in Word 2000 VBA, but I heard from a co-worker that there are more than 1 in Word XP. Because I dont have that version here, I cannot tell if this particular event is present and my code is working in Word XP.
JanB
-
WSJanB
AskWoody LoungerI think you discovered the single most frustrating thing for Word developers IMHO. It should be a consolation that there are millions of other developers all over the world that suffer with you… NOT!
If you really need the forms functionality – as we do – then there is really no alternativ I know of than to “hijack” all the relevant internal Word functions by writing your own Sub’s performing exactly the same task and storing those Sub’s in a add-in placed in the Word Startup folder. But even then there are quit a few drawbacks!For your particular problem there may be a work-around. From what you write I understand that you know how to use the checkboxes from the Forms toolbar. You can accomplish almost the same functionality with the checkboxes from the Toolset toolbar (not quite sure about this name, had to translate it from my Dutch version…). The VBA Sub’s handling these checkboxes must reside in the ThisDocument module.
I have no personal experience with these checkboxes. But I have a few documents with a commandbutton to perform a certain task. And that works fine in a unprotected document. The only drawback in my case is that this commandbuttons (and other controls) are always printed – at least I haven’t discovered yet how to prevent that.. But if that is no problem for your situation then this could be something to experiment with.Good luck
JanB -
WSJanB
AskWoody LoungerI think you discovered the single most frustrating thing for Word developers IMHO. It should be a consolation that there are millions of other developers all over the world that suffer with you… NOT!
If you really need the forms functionality – as we do – then there is really no alternativ I know of than to “hijack” all the relevant internal Word functions by writing your own Sub’s performing exactly the same task and storing those Sub’s in a add-in placed in the Word Startup folder. But even then there are quit a few drawbacks!For your particular problem there may be a work-around. From what you write I understand that you know how to use the checkboxes from the Forms toolbar. You can accomplish almost the same functionality with the checkboxes from the Toolset toolbar (not quite sure about this name, had to translate it from my Dutch version…). The VBA Sub’s handling these checkboxes must reside in the ThisDocument module.
I have no personal experience with these checkboxes. But I have a few documents with a commandbutton to perform a certain task. And that works fine in a unprotected document. The only drawback in my case is that this commandbuttons (and other controls) are always printed – at least I haven’t discovered yet how to prevent that.. But if that is no problem for your situation then this could be something to experiment with.Good luck
JanB -
WSJanB
AskWoody LoungerHi Boyley,
Maybe you can use something along these lines:
1. Place the templates in separate subdirs for each department (Dept1; Dept2; etc.)
2. Write Sub DeptTemplates
3a. Place a button on the Toolbar that calls DeptTemplates (if you want to preserve the standard FileNew command)
or
3b. Rename Sub DeptTemplates to FileNew (if you want to “hijack” the standard FileNew command)Public Sub DeptTemplates
Dim strOld As String
Dim strDept As String
strDept = InputBox(“Department name?”)
strOld = Options.DefaultFilePath(wdWorkgroupTemplatesPath)
Options.DefaultFilePath(wdWorkgroupTemplatesPath) = “” & strDept
Dialogs(wdDialogFileNew).Show
Options.DefaultFilePath(wdWorkgroupTemplatesPath) = strOld
End SubOfcourse you can use a dialog panel with a drop-down list for the departments. Otherwise you have to put some code in this Sub to check wether the user input is in fact an existing department. If not you can put the Inputbox on the screen again, or revert to a default path.
The lines with strOld in them can be omitted, but I think it’s good practice to put things back to the state/value it had before my code changed it.Hope this helps
JanB -
WSJanB
AskWoody LoungerHi Boyley,
Maybe you can use something along these lines:
1. Place the templates in separate subdirs for each department (Dept1; Dept2; etc.)
2. Write Sub DeptTemplates
3a. Place a button on the Toolbar that calls DeptTemplates (if you want to preserve the standard FileNew command)
or
3b. Rename Sub DeptTemplates to FileNew (if you want to “hijack” the standard FileNew command)Public Sub DeptTemplates
Dim strOld As String
Dim strDept As String
strDept = InputBox(“Department name?”)
strOld = Options.DefaultFilePath(wdWorkgroupTemplatesPath)
Options.DefaultFilePath(wdWorkgroupTemplatesPath) = “” & strDept
Dialogs(wdDialogFileNew).Show
Options.DefaultFilePath(wdWorkgroupTemplatesPath) = strOld
End SubOfcourse you can use a dialog panel with a drop-down list for the departments. Otherwise you have to put some code in this Sub to check wether the user input is in fact an existing department. If not you can put the Inputbox on the screen again, or revert to a default path.
The lines with strOld in them can be omitted, but I think it’s good practice to put things back to the state/value it had before my code changed it.Hope this helps
JanB -
WSJanB
AskWoody LoungerAnd, according to Woody, Office 2003 Professional has a full implementation of XML and that alone should be worth the upgrade.
JanB
-
WSJanB
AskWoody LoungerAnd, according to Woody, Office 2003 Professional has a full implementation of XML and that alone should be worth the upgrade.
JanB
-
WSJanB
AskWoody LoungerI typed that on the fly and did not check if there are any items in the pick list for the FileNew dialog.
Sorry that this is no solution for your particular issue. But look at the bright side: you learned something.
And I did too…!JanB
-
WSJanB
AskWoody LoungerI typed that on the fly and did not check if there are any items in the pick list for the FileNew dialog.
Sorry that this is no solution for your particular issue. But look at the bright side: you learned something.
And I did too…!JanB
-
WSJanB
AskWoody LoungerIt is possible to set a specific tab as the default when opening a dialog:
Dialogs(wdDialogFileNew).DefaultTab = xxx
As soon as you type the “=” you get a pop-up list with all the possibilities. Unfortunately this list contains all tabs, not just the ones for the dialog you want (wdDialogFileNew in this case).
Hope this helps.
JanB
![]() |
There are isolated problems with current patches, but they are well-known and documented on this site. |
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
-
.NET 8.0 Desktop Runtime (v8.0.16) – Windows x86 Installer
by
WSmeyerbos
10 hours, 34 minutes ago -
Neowin poll : What do you plan to do on Windows 10 EOS
by
Alex5723
6 hours, 18 minutes ago -
May 31, 2025—KB5062170 (OS Builds 22621.5415 and 22631.5415 Out-of-band
by
Alex5723
9 hours, 8 minutes ago -
Discover the Best AI Tools for Everything
by
Alex5723
9 hours, 17 minutes ago -
Edge Seems To Be Gaining Weight
by
bbearren
10 hours ago -
Rufus is available from the MSFT Store
by
PL1
7 hours, 29 minutes ago -
Microsoft : Ending USB-C® Port Confusion
by
Alex5723
1 day, 10 hours ago -
KB5061768 update for Intel vPro processor
by
drmark
16 hours, 45 minutes ago -
Outlook 365 classic has exhausted all shared resources
by
drmark
12 hours, 56 minutes ago -
My Simple Word 2010 Macro Is Not Working
by
mbennett555
1 day, 6 hours ago -
Office gets current release
by
Susan Bradley
1 day, 8 hours ago -
FBI: Still Using One of These Old Routers? It’s Vulnerable to Hackers
by
Alex5723
2 days, 22 hours ago -
Windows AI Local Only no NPU required!
by
RetiredGeek
2 days, 7 hours ago -
Stop the OneDrive defaults
by
CWBillow
2 days, 23 hours ago -
Windows 11 Insider Preview build 27868 released to Canary
by
joep517
3 days, 9 hours ago -
X Suspends Encrypted DMs
by
Alex5723
3 days, 11 hours ago -
WSJ : My Robot and Me AI generated movie
by
Alex5723
3 days, 12 hours ago -
Botnet hacks 9,000+ ASUS routers to add persistent SSH backdoor
by
Alex5723
3 days, 12 hours ago -
OpenAI model sabotages shutdown code
by
Cybertooth
3 days, 13 hours ago -
Backup and access old e-mails after company e-mail address is terminated
by
M W Leijendekker
3 days, 1 hour ago -
Enabling Secureboot
by
ITguy
3 days, 8 hours ago -
Windows hosting exposes additional bugs
by
Susan Bradley
3 days, 21 hours ago -
No more rounded corners??
by
CWBillow
3 days, 16 hours ago -
Android 15 and IPV6
by
Win7and10
3 days, 6 hours ago -
KB5058405 might fail to install with recovery error 0xc0000098 in ACPI.sys
by
Susan Bradley
4 days, 9 hours ago -
T-Mobile’s T-Life App has a “Screen Recording Tool” Turned on
by
Alex5723
4 days, 12 hours ago -
Windows 11 Insider Preview Build 26100.4202 (24H2) released to Release Preview
by
joep517
4 days, 6 hours ago -
Windows Update orchestration platform to update all software
by
Alex5723
4 days, 19 hours ago -
May preview updates
by
Susan Bradley
4 days, 6 hours ago -
Microsoft releases KB5061977 Windows 11 24H2, Server 2025 emergency out of band
by
Alex5723
3 days, 22 hours ago
Recent blog posts
Key Links
S | M | T | W | T | F | S |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 |
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.