Groups | Blog | Home
all groups > dotnet interop > may 2006 >

dotnet interop : Word 2007 Application Call Problem


Simon Richardson
5/28/2006 2:09:01 PM
I have always used the CreateObject("word.application") to call word
automatically from my applications but it doesn't seem to be working with
Word 2007.

My code is:-
Dim WordApp As Object
Dim WordDoc As Object
Dim WdRead As Boolean = False
WordApp = CreateObject("word.application")
WordDoc = WordApp.Documents.Open(Filename:=Chr(32) & "c:\documents
and settings\simon\my documents\fmspro_data\templates\1.dot" & Chr(32),
Readonly:=WdRead)
With WordDoc.mailmerge
.OpenDataSource(Name:="c:\documents and settings\simon\my
documents\fmspro_data\fmsmerge.csv")
.Execute()
End With
WordApp.Visible = True

An instance of Word is created but the document doesn't open and the
mailmerge fails. Does anyone know whats changed and if there is some code
that will work with Word 2000, 2003 and 2007 (if possible).

Thank you in advance.
Simon
Simon Richardson
5/29/2006 2:50:01 AM

Managed to resolve it by removing the CHR(34) bits of the filename.
Just hoping thats compatible with the previous versions of word but will
have to do some testing.
Hopefully this will help others with the same problem.

[quoted text, click to view]
AddThis Social Bookmark Button