Hi,
I hope this is the right place to post this question.
I am using VB6 to create an application that uses MS Word 2010
to print labels. My question is how do I change the font size, name etc. in a Word Bookmark that is inside a textfield (shape). I can change the font in a plain document but not if the bookmark is inside a textfield.
Thank's in advance,
Henrik
I have been trying the following code:
If doc.Bookmarks.Exists("Barcode1") Then
If doc.Bookmarks("Barcode1").Range.Font.Size = MultiSelection Then
' the range of the bookmark consists of runs with different font sizes
doc.Bookmarks("Barcode1").Range.Font.Size = 20
Else
doc.Bookmarks("Barcode1").Range.Font.Size _
= doc.Bookmarks("Barcode1").Range.Font.Size + 4
End If
End If
And this too:
Dim WordObj As Word.Application
Set WordObj = CreateObject("Word.Application")
Dim objWord As Word.Document
Set objWord = WordObj.Documents.Open(FileName:=App.Path & "\LabelLayout\test.docx") '" & SelectedLabelLayout & ".docx") '"C:\Users\Henrik\Documents\L7159test.docx") 'Test.docx")
WordObj.Visible = True
With objWord.Bookmarks
.Item("Barcode1").Range.Text = txtEtiket(0).Text 'txtName
.Item("Barcode1").Range.FormattedText.Font.Name = "Segoe UI" 'Font.Color = wdColorRed
.Item("Barcode1").Range.FormattedText.Font.Size = "16"
End with
I hope this is the right place to post this question.
I am using VB6 to create an application that uses MS Word 2010
to print labels. My question is how do I change the font size, name etc. in a Word Bookmark that is inside a textfield (shape). I can change the font in a plain document but not if the bookmark is inside a textfield.
Thank's in advance,
Henrik
I have been trying the following code:
If doc.Bookmarks.Exists("Barcode1") Then
If doc.Bookmarks("Barcode1").Range.Font.Size = MultiSelection Then
' the range of the bookmark consists of runs with different font sizes
doc.Bookmarks("Barcode1").Range.Font.Size = 20
Else
doc.Bookmarks("Barcode1").Range.Font.Size _
= doc.Bookmarks("Barcode1").Range.Font.Size + 4
End If
End If
And this too:
Dim WordObj As Word.Application
Set WordObj = CreateObject("Word.Application")
Dim objWord As Word.Document
Set objWord = WordObj.Documents.Open(FileName:=App.Path & "\LabelLayout\test.docx") '" & SelectedLabelLayout & ".docx") '"C:\Users\Henrik\Documents\L7159test.docx") 'Test.docx")
WordObj.Visible = True
With objWord.Bookmarks
.Item("Barcode1").Range.Text = txtEtiket(0).Text 'txtName
.Item("Barcode1").Range.FormattedText.Font.Name = "Segoe UI" 'Font.Color = wdColorRed
.Item("Barcode1").Range.FormattedText.Font.Size = "16"
End with