formatting text from recordsets

T

Tom George

Hi,
I am a noob at word vba and I am hoping someone can help me here.

i am reading records from a recordset and inserting them into my word
document. the records are data type of text.

I am able to open the recordset and insert the records into my document by
looping through the recordset.
The problem that i am having is that I want to format certain records after
I put them into my document. I would like to take one record and make it as
a header by changing the style - "Heading 1".

I can not find any good way to do this. I am thinking that the forst problem
I might be having is the way that I a inserting the records, using the
InsertAfter method with the Selection object:

Selection.InsertAfter Text:=CleanHTML(objRS(0).Value) 'CleanHTML is a
function that strips the HTML characters from the record
My current attempt at changing the style is this:

ActiveDocument.Paragraphs(Counter).Style = "Heading 1" 'counter is a count
of the paragraphs, so that I can affect only the last paragraph inserted.

It seems that any format changes that I make affect the whole document.

I guess what i really need is a method to change the formatting of only the
'current' paragraph or record that I am inserting. Any advice on how to do
this and how to insert these records into my document would be greatly
appreciated!

TIA,

Tom George
 
H

Helmut Weber

Hi Tom,
It seems that any format changes that I make affect the whole document.

could it be that in the dialog "modify style"
for "heading 1" the option "automatically update" is checked?

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
 

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