Solved

How to save bookmark formatting in VBA

Posted on 2007-03-26
1
266 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
Comment Utility
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

If you work with Word a lot, you probably use styles. If you use styles a lot, you've probably balled your fist more often than not when working with the ribbon. In Word 2007/2010, one of the things that I find missing when using styles is a quic…
I would like to show you some basics you can do with Mailings in MS Word. It´s quite handy feature you can use for creating envelopes, labels, personalized letters etc. First question could be what is this feature good for? Mailing can really he…
This video shows where to find the word count, how to display it, and what it breaks down to in Microsoft Word.
This video shows where to find templates, what they are used for, and how to create and save a custom template using Microsoft Word.

771 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now