Setting a character style

  • Thread starter Stephen English
  • Start date
S

Stephen English

I am creating Word documents from an Access database and I am trying to
insert two fields into one line so I thought I could do it with a character
style (NormalBold) but the paragraph style is overriding it
My code is
rngWord.Collapse wdCollapseEnd
With rngWord
.Style = "NormalBold"
.InsertAfter "Tel: " & rs!Clubphone
End With
rngWord.Collapse wdCollapseEnd
With rngWord
.Style = "Normal"
.InsertAfter vbTab
If Not IsNull(rs!Clubfax) Then
.InsertAfter "Fax: " & rs!Clubfax & vbCrLf
Else
.InsertAfter vbCrLf
End If

Any ideas please
 
K

Klaus Linke

Hi Stephen,

Instead of

With rngWord
.Style = "NormalBold"
.InsertAfter "Tel: " & rs!Clubphone
End With

try

With rngWord
.Text = "Tel: "& rs!Clubphone
.Style = "NormalBold"
End With

.... or some other solution where you keep track of the range of the inserted
text, then apply the style.

Regards,
Klaus
 

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

Top