Hi all
I am still trying to create a report in Word 2010 from data out of Excel 2010.
As part of report I need to apply styles to text within the report so that the table of contents updates correctly. Despite every effort I have been unable to apply the formatting.
In the following I am trying to apply the style "Heading 1" to the text added at the bookmark.
All the reading and experimenting has led me in circles.
Is anyone able to please shed some light? If more information is required, please let me know.
Kind regards
Shaun
I am still trying to create a report in Word 2010 from data out of Excel 2010.
As part of report I need to apply styles to text within the report so that the table of contents updates correctly. Despite every effort I have been unable to apply the formatting.
In the following I am trying to apply the style "Heading 1" to the text added at the bookmark.
All the reading and experimenting has led me in circles.
Code:
...
ActiveDocument.Bookmarks.Add ("ClientName1")
ClientName1 = ActiveWorkbook.Sheets("Entity Details").Range("C3")
With objDoc
If objDoc.Bookmarks.Exists("ClientName1") Then
.Bookmarks("ClientName1").Range.Text = Clientname1
.Selection.Style = ActiveDocument.Styles("Heading1")
End If
End With
...
Is anyone able to please shed some light? If more information is required, please let me know.
Kind regards
Shaun