Font in Bookmarks

  • Thread starter Thread starter KHogwood-Thompson
  • Start date Start date
K

KHogwood-Thompson

Hi All,

I have a document using Arial 10 that has several bookmarks in it, I am
using a userform to update these bookmarks, but I want the text inserted at
the bookmarks to have a font size of 8. How can I achieve this as currently
when the bookmarks are updated they take on the same font as the body of the
document i.e size 10.

Many thanks
 
Add the font parameter to the userform code that writes the content to the
document.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
Thanks for the hint, this is the code that writes the content to the
document, where would the font parameter go?

Set BMRange = .Bookmarks("JOB_NO").Range
BMRange.Text = JobNoTextBox
.Bookmarks.Add "JOB_NO", BMRange
 
Set BMRange = .Bookmarks("JOB_NO").Range
With BMRange
.Font.Name = "Arial"
.Font.Size = "8"
.Text = JobNoTextBox
End With
.Bookmarks.Add "JOB_NO", BMRange


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
Hi Graham,

Yes this code makes sense, however when I run it, the bookmarks are still
updated with Arial size 10.
 
Obviously I don't have all your code - only the snippet you posted. If I
change the .Text to
.Text = "JobNoTextBox"
as I don't have the code that generates this information, then it works as
suggested.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
I see your point, however it does not work in my document. Not sure if it
makes a difference but the document that I am working on is being created
from a template.

I have created another template to test your code and have the following VBA
behind the OK button :

Private Sub cmdOK_Click()

With ActiveDocument

Set BMRange = .Bookmarks("TEST").Range
With BMRange
.Font.Name = "Arial"
.Font.Size = "8"
.Text = TestTextBox
End With
.Bookmarks.Add "TEST", BMRange

End With

End Sub

The result is Arial Font size 12.

Not sure what is going on here but it is frustrating
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top