Automating Word via Excel

J

John Wilson

Having a dilemma here trying to add some text to an existing Word document.

I can use a bookmark and get my text into the document with a
Dim wordRange As Object
wordRange.InsertAfter

The problem with the above is that it "inserts" as opposed to "overwrite"
and
shifts all my other text and lines.

I've tried setting .Overtype to True and still no luck.

So my next adventure was to create a textbox via the controls toolbox
positioned
where I needed it and populate it from Excel but I can't determine how to
access
the textbox from Excel.

Anyone have any ideas on how I can do this or maybe another workaround?

Thanx,
John
 
J

Jonathan West

Don't use the Controls toolbar, use the Insert menu. That gives you an
entirely different kind of textbox.

If you want to add the textbox from code, use the
ActiveDocument.Shapes.AddTextbox method.

Once you have the textbox, you can insert text into its TextFrame.TextRange
object.
 
J

John Wilson

Jonathan,
use the Insert menu.
Tried that, but I need a few of them.
How would I differentiate one from the other?
I don't see how they're named.
If you want to add the textbox from code
I already have a document. It's a Permit Application from the
NYC Dept. of Transportation. I'd rather try to work with it
than recreate it. (It's in .doc format)
you can insert text into its TextFrame.TextRange
Again, how to differentiate. How do I find the "object" name?

Thanks,
John
 

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