![]() |
|
#1
|
|||
|
|||
|
Hi All,
I am looking for some ideas please. This is the first time I am using VB so still am very fresh here. I am working on a simple word document, where the front page is used to check boxes and based on true false values it inserts texts in bookmark fields further down the document. Managed to get all with the help of this Forum but got stuck with one step. The text I am inserting looks like below: "Title First line" What I want to do is to make word "Title" bold and leave the rest non-bold. Option Explicit Dim oRng As Range Dim oBM As Bookmark Private Sub CheckBox1_Click() If Me.CheckBox1.Value = True Then Set oRng = ActiveDocument.Bookmarks("Text1").Range oRng.Text = "Title" & Chr(10) & "First line" ActiveDocument.Bookmarks.Add "Text1", oRng With oRng.Font .Bold = True End With Else: Set oRng = ActiveDocument.Bookmarks("Text1").Range oRng.Text = "Blank" ActiveDocument.Bookmarks.Add "Text1", oRng With oRng.Font .Bold = False End With End If End Sub It could do something with selecting the range but I am unsure how. Any thoughts would be greatly appreciated. |
| Tags |
| bold header |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
How to code a Find&Replace macro to remove a tab and bold the entire para
|
Frogoogue | Word VBA | 4 | 05-30-2022 09:15 AM |
bold (or unbold) section of text instead of bold toggling
|
Burt | Word | 6 | 04-06-2019 09:09 AM |
Text in #1 is made bold, rest of the document is edited, text in #1 is now not bold
|
footer-assistance | Word | 1 | 06-29-2015 03:49 AM |
Not Bold text but it comes up bold
|
Pluviophile | Word | 7 | 10-22-2013 10:29 AM |
VBA code to extract specific bookmarks from multiple word files
|
Rattykins | Word VBA | 4 | 06-27-2012 10:02 PM |