-
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, but widespread attacks make patching prudent. Go ahead and patch, but watch out for potential problems. |
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
-
France : A law requiring messaging apps to implement a backdoor ..
by
Alex5723
4 hours, 22 minutes ago -
Dev runs Windows 11 ARM on an iPad Air M2
by
Alex5723
5 hours, 10 minutes ago -
MS-DEFCON 3: Cleanup time
by
Susan Bradley
11 minutes ago -
KB5056686 (.NET v8.0.15) Delivered Twice in April 2025
by
lmacri
35 minutes ago -
How to enable Extended Security Maintenance on Ubuntu 20.04 LTS before it dies
by
Alex5723
16 hours, 24 minutes ago -
Windows 11 Insider Preview build 26200.5562 released to DEV
by
joep517
20 hours, 22 minutes ago -
Windows 11 Insider Preview build 26120.3872 (24H2) released to BETA
by
joep517
20 hours, 24 minutes ago -
Unable to eject external hard drives
by
Robertos42
2 hours, 17 minutes ago -
Saying goodbye to not-so-great technology
by
Susan Bradley
4 hours, 15 minutes ago -
Tech I don’t miss, and some I do
by
Will Fastie
1 hour, 27 minutes ago -
Synology limits hard drives
by
Susan Bradley
2 days ago -
Links from Microsoft 365 and from WhatsApp not working
by
rog7
1 day, 3 hours ago -
WhatsApp Security Advisories CVE-2025-30401
by
Alex5723
2 days, 6 hours ago -
Upgrade Sequence
by
doneager
2 days ago -
Chrome extensions with 6 million installs have hidden tracking code
by
Nibbled To Death By Ducks
5 hours, 35 minutes ago -
Uninstall “New Outlook” before installing 2024 Home & Business?
by
Tex265
22 hours, 49 minutes ago -
The incredible shrinking desktop icons
by
Thumper
3 days, 3 hours ago -
Windows 11 Insider Preview Build 22635.520 (23H2) released to BETA
by
joep517
3 days, 5 hours ago -
Connecting hard drive on USB 3.2 freezes File Explorer & Disk Management
by
WSJMGatehouse
4 hours, 20 minutes ago -
Shellbag Analyser & Cleaner Update
by
Microfix
1 day, 14 hours ago -
CISA warns of increased breach risks following Oracle Cloud leak
by
Nibbled To Death By Ducks
3 days, 14 hours ago -
Outlook 2024 two sent from email addresses
by
Kathy Stevens
2 days, 19 hours ago -
Speeding up 11’s search
by
Susan Bradley
1 day, 2 hours ago -
HP Pavilion Will Not Wake Up After Being Idle for Longer Period
by
WSwalterwood44
1 day, 14 hours ago -
Make a Windows 11 Local Account Passwordless
by
Drcard:))
4 days, 4 hours ago -
Ubuntu 25.04 (Plucky Puffin)
by
Alex5723
4 days, 12 hours ago -
24H2 fixed??
by
CWBillow
3 days, 4 hours ago -
Uninstalr Updates
by
jv16
4 days, 17 hours ago -
Apple zero days for April
by
Susan Bradley
13 hours, 54 minutes ago -
CVE program gets last-minute funding from CISA – and maybe a new home
by
Nibbled To Death By Ducks
3 days, 14 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.