Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 07-12-2012, 02:50 PM
macropod's Avatar
macropod macropod is offline Open header to insert text into bookmark Windows 7 64bit Open header to insert text into bookmark 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

Hi Christine,

Try:
Call UpdateBookmark("BMQuoteNumberHeader", txtQuoteNumber.Text)
with:
Code:
Sub UpdateBookmark(BmkNm As String, NewTxt As String)
Dim BmkRng As Range
With ActiveDocument
  If .Bookmarks.Exists(BmkNm) Then
    Set BmkRng = .Bookmarks(BmkNm).Range
    BmkRng.Text = NewTxt
    .Bookmarks.Add BmkNm, BmkRng
  End If
End With
Set BmkRng = Nothing
End Sub
Note: There is no need for the GoTo, to explicitly access the header, or to select anything. Furthermore, unlike your code, if you change your mind about what should appear in the header, the content gets changed - your's just appends the new content.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Repeating Bookmark Text BECKTHOMO Word 1 03-27-2012 08:34 PM
Open header to insert text into bookmark Word 2003 - IncludeText Does Not Include Bookmark Text if in a Form Text Control skarden Word 1 12-12-2011 10:39 PM
Open header to insert text into bookmark Insert a header name in the text (body) bal-007 Word 3 11-25-2011 01:08 PM
Open header to insert text into bookmark delete all bookmark text hklein Word VBA 4 08-10-2011 04:33 AM
Open header to insert text into bookmark VBA to insert Bookmark rockwellsba Word VBA 2 05-31-2011 01:07 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 07:05 AM.


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