-
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
-
Where’s the cache today?
by
Up2you2
2 hours, 58 minutes ago -
Ascension says recent data breach affects over 430,000 patients
by
Nibbled To Death By Ducks
6 hours ago -
Nintendo Switch 2 has a remote killing switch
by
Alex5723
6 hours, 21 minutes ago -
Blocking Search (on task bar) from going to web
by
HenryW
11 hours, 1 minute ago -
Windows 10: Microsoft 365 Apps will be supported up to Oct. 10 2028
by
Alex5723
16 hours, 8 minutes ago -
Add or Remove “Ask Copilot” Context Menu in Windows 11 and 10
by
Alex5723
16 hours, 15 minutes ago -
regarding april update and may update
by
heybengbeng
17 hours, 44 minutes ago -
MS Passkey
by
pmruzicka
1 hour, 4 minutes ago -
Can’t make Opera my default browser
by
bmeacham
1 day, 1 hour ago -
*Some settings are managed by your organization
by
rlowe44
12 hours, 8 minutes ago -
Formatting of “Forward”ed e-mails
by
Scott Mills
1 day ago -
SmartSwitch PC Updates will only be supported through the MS Store Going Forward
by
PL1
1 day, 20 hours ago -
CISA warns of hackers targeting critical oil infrastructure
by
Nibbled To Death By Ducks
2 days, 5 hours ago -
AI slop
by
Susan Bradley
19 hours, 6 minutes ago -
Chrome : Using AI with Enhanced Protection mode
by
Alex5723
2 days, 6 hours ago -
Two blank icons
by
CR2
18 hours, 2 minutes ago -
Documents, Pictures, Desktop on OneDrive in Windows 11
by
ThePhoenix
2 days, 15 hours ago -
End of 10
by
Alex5723
2 days, 17 hours ago -
Single account cannot access printer’s automatic duplex functionality
by
Bruce
1 day, 15 hours ago -
test post
by
gtd12345
2 days, 23 hours ago -
Privacy and the Real ID
by
Susan Bradley
2 days, 14 hours ago -
MS-DEFCON 2: Deferring that upgrade
by
Susan Bradley
16 hours, 21 minutes ago -
Cant log on to oldergeeks.Com
by
WSJonharnew
3 days, 4 hours ago -
Upgrading from Win 10
by
WSjcgc50
1 day, 15 hours ago -
USB webcam / microphone missing after KB5050009 update
by
WSlloydkuhnle
1 day, 19 hours ago -
TeleMessage, a modified Signal clone used by US government has been hacked
by
Alex5723
3 days, 19 hours ago -
The story of Windows Longhorn
by
Cybertooth
3 days, 7 hours ago -
Red x next to folder on OneDrive iPadOS
by
dmt_3904
3 days, 21 hours ago -
Are manuals extinct?
by
Susan Bradley
22 hours, 13 minutes ago -
Canonical ditching Sudo for Rust Sudo -rs starting with Ubuntu
by
Alex5723
4 days, 7 hours 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.