Different Word behavior on early vs late binding

C

Carl Mercier

I'm trying to launch a mail merge through automation from VB.NET. The code
works perfect with early binding. However, I'd rather use late binding in
order to support older Word versions (I'm using 2003).

When late binding (with the exact same code), Word always opens a
"Document1" blank document when I create the "Word.Application" object.
This behavior is not present with early binding, it just opens Word with no
default document. Is there anything I'm doing wrong? Here's a code
snippet...

Dim wrdApp As Object 'Word.Application

Try

' Create an instance of Word and make it visible.
wrdApp = CreateObject("Word.Document")
wrdApp.Application.Visible = True
Catch
Finally
wrdApp = Nothing
End Try

Thanks in advance!
 
C

Carl Mercier

Now I feel stupid :)

I do know I had to instantiate Word.Application... I've tried just about
everything without even noticing .Document was there. Oh well... I guess I
need that weekend huh!? :)

Thanks for the pointer, Jonathan. I hope not to post stupid questions like
that again in the future :)

Carl
 
J

Jonathan West

Carl Mercier said:
Now I feel stupid :)

I do know I had to instantiate Word.Application... I've tried just about
everything without even noticing .Document was there. Oh well... I guess
I need that weekend huh!? :)

Thanks for the pointer, Jonathan. I hope not to post stupid questions
like that again in the future :)

Don't worry. It happens to us all at one time or another!


--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org
 

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