Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 01-03-2017, 01:28 AM
macropod's Avatar
macropod macropod is offline Spaces inside Fieldcode curly braces Windows 7 64bit Spaces inside Fieldcode curly braces Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

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]
Reply With Quote
 



Similar Threads
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
Spaces inside Fieldcode curly braces What does <!//FieldCode**> indicate? 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

Other Forums: Access Forums

All times are GMT -7. The time now is 10:02 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft