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
but nothing it is happening.. so, I know this is for excel but maybe someone know this.
thx
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