Solved

How to save bookmark formatting in VBA

Posted on 2007-03-26
1
269 Views
Last Modified: 2012-08-13
I have a macro that saves the range of a bookmark, but I want to keep the formatting of the text in the bookmark also.  How can I do that?

Here is some code I use:

Set Rng1 = ActiveDocument.Bookmarks("SerialNumber").Range

    Rng1.Delete
    Rng1.Text = SerialNumber

SO, you can see that I am trying replace the SerialNumber in the range.  I have formatted the bookmark, but it appears that also gets deleted and the default formatting is used.

Thanks
Ep
0
Comment
Question by:dickep
1 Comment
 
LVL 14

Accepted Solution

by:
Glenn_Moore earned 500 total points
ID: 18799836
Create your own macro with the formatting you want, and then incorporate this text into your routine.

To record a macro to conditionally format:

Open up a document with your Bookmark, Tools, Macro, Record New Macro, give it a name, and conditionally format yourbookmark .  Stop recording.  
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When creating Microsoft Word-based forms there may be a need to have a form field repeated throughout the whole document. For instance, with a company name, you may want this information repeated automatically throughout the document rather than man…
Preface: When I started this series, I used the term CommandBars because that is the Office Object class that it discusses. Unfortunately, when Microsoft introduced Office 2007, they replaced the standard Commandbar menus with "The Ribbon" and rem…
This video walks the viewer through the process of creating an MLA formatted document, as well as a bibliography with citations.
This video walks the viewer through the process of creating Hyperlinks for the web and other documents. Select the "Insert" tab: Click "Hyperlink":  Type "http://" followed by a web address to reference a website or navigate to a document to ref…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question