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 - 29 May 2006 10:50 GMT
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.
> I have always used the CreateObject("word.application") to call word
> automatically from my applications but it doesn't seem to be working with
[quoted text clipped - 21 lines]
> Thank you in advance.
> Simon