-
WSMesaka
AskWoody LoungerSeptember 17, 2009 at 3:14 pm in reply to: Is it possible to bookmark a Word field using VBA? #1177750Thanks. (The Pennsylvania Dutch in me craves as few lines of code as possible!)
-
WSMesaka
AskWoody LoungerSeptember 17, 2009 at 2:00 pm in reply to: Is it possible to bookmark a Word field using VBA? #1177735OK, I managed to kludge this workaround. Any comments? Suggestions?
[indent]Function InsertBookmarkedField(rngLocation As Range, strButtonText As String, Optional bmkProperty As String) As Range
Dim NewField As Field
[indent] Set NewField = rngLocation.Fields.Add(Range:=rngLocation, Text:=”MACROBUTTON nomacro ” & strButtonText, PreserveFormatting:=False)
NewField.Code.Text = Trim(NewField.Code.Text)
Set rngLocation = NewField.Result
rngLocation.MoveStart wdCharacter, -1
If bmkProperty “” Then ActiveDocument.Bookmarks.Add Name:=bmkProperty, Range:=rngLocation
Set InsertBookmarkedField = NewField.Result[/indent]
End Function[/indent]
(I made the Bookmarking bit optional.)
-
WSMesaka
AskWoody LoungerAh, I see… sorry. Yes, they do.
-
WSMesaka
AskWoody LoungerNo, sorry; let me be clearer. The latest screen cap shows how it looks at present.
After the first screen cap, I renamed them ALL (without spaces), which had no effect. Then I INSERTED a space in each one, which had the odd effect of pushing “Module 5” to the beginning of the list, with the rest alphanumerically sorted. Then I removed the space from each of the file names. The current appearance is what is shown in the latest screen cap.
I actually discovered that OTHER people see the same thing, i.e. it’s not sorting according to any pattern that I can discern.
The list of folders is currently displayed in Windows Explorer sorted by Type (which, in Windows, sorts first by extension and then alphanumerically within type.) However, it didn’t matter at all how I was viewing them; the way they are sorted (e.g. date, reverse date, name) has no effect whatsoever on how they are listed in the dialog box.
-
WSMesaka
AskWoody LoungerThat was a good thing to check on, but it’s produced an even weirder sort. Specifically, I renamed them ALL to include a space before the number, and they STILL didn’t sort right. Changing them BACK so that there were no spaces in the filename, I now have THIS!
I give up…
-
WSMesaka
AskWoody LoungerI tried that, but no luck. In fact, I should mention that other users are seeing the same phenomenon.
Very wierd!
-
WSMesaka
AskWoody LoungerThanks, all… very helpful!
plus ça change, plus c’est la choses mauvais séjour
-
WSMesaka
AskWoody LoungerAnd there ya go… Whoulda thunk?
Thanks so much for figuring that out. I don’t think I would have even thought of trying that. I will shuffle off with my problem-solving skills humbled.
Thanks again!
-
WSMesaka
AskWoody LoungerThat’s what I thought… but when I paste, it pastes below (vertically) the canvas, and the two things appear and behave as independent objects. (For example, deleting the canvas should effectively remove the graphic, shouldn’t it?)
I was trying to work that way anyway, but the problem was that the lines from any callouts I added wound up behind the drawing that I was annotating, at least until I selected the graphic and used “Send behind text,” which apparently also sent it behind the canvas.
Something is not working as I expect it to, and I’m not sure whether my expectations are out of line…
I am attaching a copy of the file to see if it behaves the same for you or anyone else. I applied a light-red outline to the canvas so that its location was readily apparent.
-
WSMesaka
AskWoody LoungerYour initial symptom (native VBA functions not being recognised) is usually down to a missing reference under Tools-References in the VBEditor.
That’s what I figured, too. But it appeared that all necessary references were present and accounted for. In fact, I couldn’t de-select the reference to VBA even when i tried. But as I said, once I successfully compiled the code (after having to take out the bogus code leftover from Word 2003 that worked with Command bars and the like), it seemed much happier; at least it compiled and ran.
However, and quite oddly, the word “format” ALWAYS appears in lower-case anywhere in the project, including in completely non-related routines where it is only being used as an argument for the “Find” method. (I should mention that I have no functions or subs defined as “format”, although I once did.) When I use the function in other templates in the same session, however, including in code in NORMAL.dotm, it shows correctly in Init Caps.
It’s a mystery… the code now runs fine, but something is amiss.
-
WSMesaka
AskWoody LoungerDo you have a module named Format? That would confuse VB.
I did, but I since removed it. In fact, once I took out (“commented,” actually) the incompatible code so that it would compile, it seems relatively happy. The one weird thing that remains, however, is that “format” will only appear in lower-case now (which was the original case of the “format” module I once had stored in the template.)
Lower-case function names make me nervous, but maybe someday I’ll open up the VB editor and find it back to normal…
-
WSMesaka
AskWoody LoungerOK, I feel like a beginner again.
I’m simply trying to format a date, but I’m stumped at every turn. Old functions such as Format(Date, “dd-MMM-yyyy”) won’t run in my new environment.
Is there a new way to work with dates, or am I missing something? How can I change the date format in my VBA code in Word 2007?
(BTW, I tried “qualifying” the “format” command–which Word 2007’s VB editor did not recognize–by changing it to VBA.Format(Date,”dd-MMM-yyyy” and it worked. Why on earth would I have to specify VBA? Visual Basic for Applications is set as a reference; in fact, I can’t DE-select it if I wanted too!)
THE THOUGHT PLICKENS…
When I write the same code in a brand new template, it works. The template in which i’m working is one that I’m gradually “converting” to be compatible with Word 2007, and which throws errors when I try to compile it (mostly pertaining to CommandBar objects.) So, I suspect that there was something other than “Date” and “Format” not being part of the new environment! Still, that was one cryptic way of failing! -
WSMesaka
AskWoody LoungerMuch obliged!
-
WSMesaka
AskWoody LoungerOh, I didn’t mean to imply that they were deleting it. (I’m in pharma, after all!) But their solution is to either 1) provide us with a URL that will somehow take us to something (webmail?) by which we can continue to access our old files, or 2) have level 2 support reconfigure folks’ Location prefs so that we can still access the NFS file (providing they leave Notes on our system.)
I’m not at ALL sure why they didn’t feel it necessary to migrate the data, too.
-
WSMesaka
AskWoody LoungerSweet! Once again, you guys make me look good.
![]() |
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
-
Ascension says recent data breach affects over 430,000 patients
by
Nibbled To Death By Ducks
1 hour, 4 minutes ago -
Nintendo Switch 2 has a remote killing switch
by
Alex5723
1 hour, 25 minutes ago -
Blocking Search (on task bar) from going to web
by
HenryW
6 hours, 5 minutes ago -
Windows 10: Microsoft 365 Apps will be supported up to Oct. 10 2028
by
Alex5723
11 hours, 13 minutes ago -
Add or Remove “Ask Copilot” Context Menu in Windows 11 and 10
by
Alex5723
11 hours, 19 minutes ago -
regarding april update and may update
by
heybengbeng
12 hours, 49 minutes ago -
MS Passkey
by
pmruzicka
36 minutes ago -
Can’t make Opera my default browser
by
bmeacham
20 hours, 29 minutes ago -
*Some settings are managed by your organization
by
rlowe44
7 hours, 12 minutes ago -
Formatting of “Forward”ed e-mails
by
Scott Mills
19 hours, 23 minutes ago -
SmartSwitch PC Updates will only be supported through the MS Store Going Forward
by
PL1
1 day, 15 hours ago -
CISA warns of hackers targeting critical oil infrastructure
by
Nibbled To Death By Ducks
2 days ago -
AI slop
by
Susan Bradley
14 hours, 11 minutes ago -
Chrome : Using AI with Enhanced Protection mode
by
Alex5723
2 days, 1 hour ago -
Two blank icons
by
CR2
13 hours, 6 minutes ago -
Documents, Pictures, Desktop on OneDrive in Windows 11
by
ThePhoenix
2 days, 10 hours ago -
End of 10
by
Alex5723
2 days, 12 hours ago -
Single account cannot access printer’s automatic duplex functionality
by
Bruce
1 day, 10 hours ago -
test post
by
gtd12345
2 days, 18 hours ago -
Privacy and the Real ID
by
Susan Bradley
2 days, 9 hours ago -
MS-DEFCON 2: Deferring that upgrade
by
Susan Bradley
11 hours, 25 minutes ago -
Cant log on to oldergeeks.Com
by
WSJonharnew
2 days, 23 hours ago -
Upgrading from Win 10
by
WSjcgc50
1 day, 11 hours ago -
USB webcam / microphone missing after KB5050009 update
by
WSlloydkuhnle
1 day, 14 hours ago -
TeleMessage, a modified Signal clone used by US government has been hacked
by
Alex5723
3 days, 14 hours ago -
The story of Windows Longhorn
by
Cybertooth
3 days, 2 hours ago -
Red x next to folder on OneDrive iPadOS
by
dmt_3904
3 days, 16 hours ago -
Are manuals extinct?
by
Susan Bradley
17 hours, 18 minutes ago -
Canonical ditching Sudo for Rust Sudo -rs starting with Ubuntu
by
Alex5723
4 days, 2 hours ago -
Network Issue
by
Casey H
3 days, 13 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.