bold or not? the bookmarks ..this is the question

white_flag

Active Member
Joined
Mar 17, 2010
Messages
331
I have the following code that will start from excel and will end in word :

this code will create an set of bookmarks in word bmk and tmk. What I do not know it is to set the fontsize and so one for apart bookmarks:
bmk to be bold size 11 and
tmk to be no_bold size 10

Code:
Sub CreateNewWordDoc() 
    Dim wrdApp As Word.Application 
    Dim wrdDoc As Word.Document 
    Dim i As Integer 
    Set wrdApp = CreateObject("Word.Application") 
    wrdApp.Visible = True 
    Set wrdDoc = wrdApp.Documents.Add 
    With wrdDoc 
        For i = 1 To 10 
            .Bookmarks.Add "bmk" & i, .Characters.Last 
            .Range.InsertAfter vbCrLf 
            .Bookmarks("bmk" & i).Range.Select 
            .Bookmarks("bmk" & i).Range.Font.Name = "Trebuchet MS" 
            .Bookmarks("bmk" & i).Range.Font.Size = 11 
            .Bookmarks("bmk" & i).Range.Font.Bold = True 
            .Bookmarks.Add "tmk" & i, .Characters.Last 
            .Range.InsertAfter vbCrLf 
            .Bookmarks("tmk" & i).Range.Select 
            .Bookmarks("tmk" & i).Range.Font.Name = "Trebuchet MS" 
            .Bookmarks("tmk" & i).Range.Font.Size = 10 
            .Bookmarks("tmk" & i).Range.Font.Bold = False 
        Next i 
        .Bookmarks("bmk1").Range.Text = "title" 
        .Bookmarks("tmk1").Range.Text = "content" 
    End With 
    Set wrdDoc = Nothing 
    Set wrdApp = Nothing 
End Sub

but nothing it is happening.. so, I know this is for excel but maybe someone know this.

thx
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.

Forum statistics

Threads
1,224,513
Messages
6,179,214
Members
452,895
Latest member
BILLING GUY

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top