-
WSJanB
AskWoody Lounger(Edited by HansV to correct typo in first path and to generalize second path)
> Jan – It didn’t work in Word 2003 but worked fine on an earlier version of Word.
I use Windows XP Pro and Office 2003, both Dutch versions, and my solution works fine on my PC.
I did a little testing and found out that there are 2 Startup directories:
1. C:Program FilesMicrosoft Office 2003OFFICE11STARTUP
2. C:Documents and SettingsApplication DataMicrosoftWordSTARTUPIf the add-in containing module AutoExec with Sub Main is placed in 1 (and Options | File locations is pointing to it) then all works fine, no questions asked. This is the path I actually use. But if I place the add-in in 2 and change Options | File locations to that directory, I get a dialog panel asking if I want the macro’s to run or not. Macro security is normally set to Average on my PC. And if I place the add-in in 1 and Options | File locations points to 2, then I also get the macro security dialog panel. And after granting permission, the code in Sub Main runs…!
So if your add-in is located in 2, you can give relocating it to 1 a try.
Good luck
Jan -
WSJanB
AskWoody Lounger(Edited by HansV to correct typo in first path and to generalize second path)
> Jan – It didn’t work in Word 2003 but worked fine on an earlier version of Word.
I use Windows XP Pro and Office 2003, both Dutch versions, and my solution works fine on my PC.
I did a little testing and found out that there are 2 Startup directories:
1. C:Program FilesMicrosoft Office 2003OFFICE11STARTUP
2. C:Documents and SettingsApplication DataMicrosoftWordSTARTUPIf the add-in containing module AutoExec with Sub Main is placed in 1 (and Options | File locations is pointing to it) then all works fine, no questions asked. This is the path I actually use. But if I place the add-in in 2 and change Options | File locations to that directory, I get a dialog panel asking if I want the macro’s to run or not. Macro security is normally set to Average on my PC. And if I place the add-in in 1 and Options | File locations points to 2, then I also get the macro security dialog panel. And after granting permission, the code in Sub Main runs…!
So if your add-in is located in 2, you can give relocating it to 1 a try.
Good luck
Jan -
WSJanB
AskWoody Lounger> Determine the height of the screen. (Can you do that?)
Determining the width and height of the screen in pixels, using VBA (Word):
System.HorizontalResolution
System.VerticalResolutionJan
-
WSJanB
AskWoody Lounger> Determine the height of the screen. (Can you do that?)
Determining the width and height of the screen in pixels, using VBA (Word):
System.HorizontalResolution
System.VerticalResolutionJan
-
WSJanB
AskWoody LoungerKerry,
If you want to do it in VBA code, and want the buttons to be available in all documents, you can create a global template stored in the Word startup directory, containing the following two little Sub’s:
Public Sub ProtectionOff()
With ActiveDocument.
If .ProtectionType wdNo Protection Then
.Unprotect Password:=”password” ‘you can omit this if no password is required
End If
End With
End SubPublic Sub ProtectionOn
With ActiveDocument
If .ProtectionType = wdNoProtection Then
.Protect Password:=”password” ‘add NoReset:=True, Type:=wdAllowOnlyFormFields if docs contain FormFields
End If
End With
End SubCreate a toolbar with two buttons that call the above Subs.
Jan
-
WSJanB
AskWoody LoungerAnother approach could be to use a CustomDocumentProperty instead to store values that you need to retrieve later.
Regards,
Jan -
WSJanB
AskWoody LoungerAnother approach could be to use a CustomDocumentProperty instead to store values that you need to retrieve later.
Regards,
Jan -
WSJanB
AskWoody LoungerGwenda,
I use a slightly different approach and that works fine on all versions of Word from 97 up.
– Create a module with the name AutoExec
– In that module create a Public Sub Main() which contains all the code you want to run at Word startup.Regards,
Jan -
WSJanB
AskWoody LoungerGwenda,
I use a slightly different approach and that works fine on all versions of Word from 97 up.
– Create a module with the name AutoExec
– In that module create a Public Sub Main() which contains all the code you want to run at Word startup.Regards,
Jan -
WSJanB
AskWoody LoungerYou can calculate the sum of the widths of all columnsin Table(1) and again for Table(2). If both values are not the same, you can adjust the width of one or more columns in Table(2).
-
WSJanB
AskWoody LoungerYou can calculate the sum of the widths of all columnsin Table(1) and again for Table(2). If both values are not the same, you can adjust the width of one or more columns in Table(2).
-
WSJanB
AskWoody LoungerI encountered the same error when opening a file with a (ore more) Sub/Function with the same name as a Sub/Function in a add-in. Temporarily de-installing the add-in and renaming the offending Sub/Function cured the problem.
Jan
-
WSJanB
AskWoody LoungerI encountered the same error when opening a file with a (ore more) Sub/Function with the same name as a Sub/Function in a add-in. Temporarily de-installing the add-in and renaming the offending Sub/Function cured the problem.
Jan
-
WSJanB
AskWoody LoungerI don’t know why the described problem occurrs, unless Table(1) is not within the specified bookmaark range.
In the past I had some trouble with bookmarks (not) containing text too and I found out that another approach worked better.
Leave at least 1 blank line before and after the table. Insert a bookmark “First” in the blank line before the table and a bookmark “Last” in the blank line after the table. Now try this code:Sub Test
Dim rngBlock As Range
With ActiveDocument
Set rngBlock = .Range(.Bookmarks(“First”).Range.End + 1, _
.Bookmarks(“Last”).Range.Start)
rngBlock.Select
End With
End SubHope this helpes.
Jan -
WSJanB
AskWoody LoungerI don’t know why the described problem occurrs, unless Table(1) is not within the specified bookmaark range.
In the past I had some trouble with bookmarks (not) containing text too and I found out that another approach worked better.
Leave at least 1 blank line before and after the table. Insert a bookmark “First” in the blank line before the table and a bookmark “Last” in the blank line after the table. Now try this code:Sub Test
Dim rngBlock As Range
With ActiveDocument
Set rngBlock = .Range(.Bookmarks(“First”).Range.End + 1, _
.Bookmarks(“Last”).Range.Start)
rngBlock.Select
End With
End SubHope this helpes.
Jan
![]() |
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
-
default apps
by
chasfinn
4 hours, 28 minutes ago -
Will MS Works 4 work in MS Win 11?
by
MileHighFlyer
2 hours, 49 minutes ago -
Adding links to text in Word 2000
by
sgeneris
13 hours, 57 minutes ago -
FBI warnings are true—fake file converters do push malware
by
Nibbled To Death By Ducks
7 hours, 9 minutes ago -
Classic and Extended Control Panel — no need to say goodbye
by
Deanna McElveen
39 seconds ago -
Things you can do in 2025 that you couldn’t do in 2024
by
Max Stul Oppenheimer
7 hours, 35 minutes ago -
Revisiting Windows 11’s File Explorer
by
Will Fastie
1 hour, 35 minutes ago -
Planning ahead for migration
by
Susan Bradley
6 hours, 43 minutes ago -
Yahoo mail getting ornery
by
Tom in Az
19 minutes ago -
Is Spectrum discontinuing email service?
by
Peobody
1 hour, 33 minutes ago -
Practice what you preach! A cautionary tale.
by
RetiredGeek
2 hours, 9 minutes ago -
Looking for Microsoft Defender Manuals/Tutorial
by
blueboy714
1 day, 21 hours ago -
Win 11 24H2 Home or Pro?
by
CWBillow
1 day, 7 hours ago -
Bipartisan Effort to Sunset the ‘26 Words That Created the Internet’..
by
Alex5723
2 days, 5 hours ago -
Outlook new and edge do not load
by
cHJARLES a pECKHAM
2 days, 17 hours ago -
Problem using exfat drives for backup
by
Danmc
2 days, 17 hours ago -
I hate that AI is on every computer we have!
by
1bumthumb
1 day, 19 hours ago -
Change Info in the Settings window
by
CWBillow
3 days ago -
Attestation readiness verifier for TPM reliability
by
Alex5723
3 days, 6 hours ago -
Windows Update says that “some settings are managed b your organization”
by
Ed Willers
2 days, 16 hours ago -
Use of Gmail rejected.
by
CBFPD-Chief115
2 days, 17 hours ago -
WuMgr operational questions
by
Tex265
17 hours, 8 minutes ago -
Beijing’s unprecedented half-marathon: Humans vs. humanoids!
by
Alex5723
3 days, 22 hours ago -
New Phishing Campaign Targeted at Mac Users
by
Alex5723
2 days, 22 hours ago -
Backing up Google Calendar
by
CWBillow
4 days, 4 hours ago -
Windows 11 Insider Preview build 27818 released to Canary
by
joep517
4 days, 17 hours ago -
File Naming Conventions (including Folders)
by
Magic66
3 days, 16 hours ago -
Windows 11 Insider Preview Build 26100.3613 (24H2) released to Release Preview
by
joep517
5 days ago -
Microsoft sends emails to Windows 10 users about EOS
by
Alex5723
4 days, 11 hours ago -
Outlook 2024 importing Calendar and Contacts – FAILURE
by
Kathy Stevens
3 days, 17 hours ago
Recent blog posts
- Classic and Extended Control Panel — no need to say goodbye
- Things you can do in 2025 that you couldn’t do in 2024
- Revisiting Windows 11’s File Explorer
- Planning ahead for migration
- Woody Leonhard (1951–2025)
- What I learned from Woody Leonhard
- Windows Settings today
- Mail Merge magic in Microsoft Word
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.