![]() |
#2
|
||||
|
||||
![]()
Fields created by Word itself usually have a space inside each of the field braces. That space isn't necessary, so field codes constructed programmatically may lack them. Fields created manually may even have more of these inconsequential spaces. That said, it's not apparent why you're not using the various Field methods that are available to you, with which it doesn't really matter whether the extra spaces are there. For example:
MsgBox Trim(ActiveDocument.Hyperlinks(1).Range.Fields(1). Code.Text) will always return the field code without any superfluous leading/trailing spaces. Similarly, for the different hyperlink elements, you might use any one or more of: Code:
With ActiveDocument.Hyperlinks(1) MsgBox "Address: " & .Address & vbCr & _ "Sub-Address: " & .SubAddress & vbCr & _ "Text To Display: " & .TextToDisplay & vbCr & _ "Screen Tip: " & .ScreenTip & vbCr & _ "Target: " & .Target End With
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Text inside text boxes create headings inside my table of contents!!! How do I delete the created he | carstj | Word | 3 | 04-11-2016 12:46 PM |
![]() |
kopp123 | Mail Merge | 1 | 09-03-2015 10:03 PM |
Straight Vs Curly Quotation Marks | FOsmund | Word | 4 | 04-16-2015 01:48 PM |
Replacing curly braces in a wildcard F&R | Ulodesk | Word | 9 | 02-21-2014 07:28 AM |
Balky Curly Quotes | JamesT | Word | 0 | 01-23-2010 05:36 PM |