By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,890 Members | 1,112 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,890 IT Pros & Developers. It's quick & easy.

Problem with Word and using ActiveDocument in ASP.Net

P: n/a
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
Nov 21 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.