All,
I'm using a word application in ASP.net (server side) to open an existing
document, do a
mail merge on it and then serve the created document to the client.
The problem I am having is when I open the word document using the
Word.Application and I
then try to access the ActiveDocument property I get an error message saying
that 'This
command is not available because no document is open. '
I have tried the exact same code in Windows forms and it works fine.
The code is;
Dim wordDoc As Word.Document
Dim wordApp As New Word.Application
fileName = "c:\killian.doc"
'
----------------------------------------------------------------
wordDoc = wordApp.Documents.Open(fileName, missing, [readOnly],
missing, missing,
missing, missing, missing, missing, missing, missing, isVisible)
With wordApp.Application
.ActiveDocument.MailMerge.MainDocumentType = wdFormLetters
The code fails here with the error 'This command is not available because no
document is
open. '
I can't figure out why this wont work. Thanks in advance for any help.
Killian