Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to save bookmark formatting in VBA

Posted on 2007-03-26
1
Medium Priority
?
283 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 14

Accepted Solution

by:
Glenn_Moore earned 1500 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

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

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

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…
Ever visit a website where you spotted a really cool looking Font, yet couldn't figure out which font family it belonged to, or how to get a copy of it for your own use? This article explains the process of doing exactly that, as well as showing how…
Learn how to create and modify your own paragraph styles in Microsoft Word. This can be helpful when wanting to make consistently referenced styles throughout a document or template.
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

670 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