Automate Word via Excel

J

John Wilson

All,

Been trying to do this for a while with no luck. Maybe someone has run into
this before??

In Word, I have a cell within a table.

I populate it via Excel with:
Set wordRange = wordDoc.GoTo(What:=-1, Name:="line2")
wordRange.InsertAfter BodyTB2
Set wordRange = wordDoc.GoTo(What:=-1, Name:="line2A")
wordRange.InsertAfter "ABC"

The above works well, but what I'm trying to accomplish is to have
"only" the "ABC" underlined. Within that cell in Word, if I set the
second bookmark as "Underlined", it won't hold the underlined
setting. Whatever the first bookmark setting is takes priority for
the whole cell.

I've tried multiple bookmarks, insert before and after the bookmark,
all sorts of formats, etc. and can't get it to work. I can't split the cell
(which would work) because I need the "ABC" to follow directly
after the the initial text that's placed in that cell.

Any ideas on how to accomplish this???

Thanks,
John
 
J

John Wilson

Just now got it to work.....finally !!!!!

Set wordRange = wordDoc.GoTo(What:=-1, Name:="line2")
wordRange.InsertAfter BodyTB2
Set wordRange = wordDoc.GoTo(What:=-1, Name:="line2A")
wordRange.InsertAfter "ABC"
wordRange.Font.Bold = True
wordRange.Font.Underline = True
 

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