change fontsize of bookmark in vba exporting data from msaccess to word

timohorn
timohorn used Ask the Experts™
on
I want toc hange the fontsize of bookmark in vba when exporting data from msacces to a word template.

i use

With .Bookmarks("Namen").Range
.Bookmarks("namen").Range.Font.Size = 12
        .Text = strText1
End With

but that does not do the trick
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Commented:
You need to select the bookmark first and then set its size

something like this

ActiveDocument.Bookmarks("Namen").Select
Selection.Font.Size = 8
Commented:
Try something like this:

    ActiveDocument.Bookmarks("Hello").Range.Select
    Selection.Text = "WTF"
    Selection.Font.Size = 40

Author

Commented:
Both answers worked, almost on the same time, so i split the points.<br /><br />I hope you're not offended.<br /><br />Thanxs<br /><br />Timo
GrahamSkanRetired
Top Expert 2012

Commented:
Note that it can be done in one step - there is no need to Select the Range.

ActiveDocument.Bookmarks("Namen").Range.Font.Size = 8

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial