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.Applicatio n 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.Applicatio n
fileName = "c:\killian.doc "
'
----------------------------------------------------------------
wordDoc = wordApp.Documen ts.Open(fileNam e, missing, [readOnly],
missing, missing, missing, missing, missing, missing, missing, missing,
isVisible)
With wordApp.Applica tion
.ActiveDocument .MailMerge.Main DocumentType = 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 1 2120
Hi,
From the top of my head - it may be that (1)there are not enough rights to
open the file or (2)the file is already opened in another instance or that
(3)there is some dialog box shown (which you have no way to see) and the
file isn't in fact opened. Try setting Application.Dis playAlerts to false to
prevent (3) at least.
Greetings
Martin
"Killian" <Ki*****@discus sions.microsoft .com> wrote in message
news:58******** *************** ***********@mic rosoft.com... 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.Applicatio n 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.Applicatio n
fileName = "c:\killian.doc "
' ---------------------------------------------------------------- wordDoc = wordApp.Documen ts.Open(fileNam e, missing, [readOnly], missing, missing, missing, missing, missing, missing, missing, missing, isVisible)
With wordApp.Applica tion .ActiveDocument .MailMerge.Main DocumentType = 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 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: bekil |
last post by:
Thanks for your suggestion Murray Jack.
I also record macro while doing it manually in word then I edit the
macro to see the required code.
Firstly I am creating a blank page. Secondly I go to second page then I
changing page properties manually and I set orientation landscape by
"this point forward".So My first page was portrait and my...
|
by: Squirrel |
last post by:
Hi everyone,
I've created a mail merge Word doc. (using Office XP) , the data source is
an Access query.
Functionality I'm attempting to set up is:
User sets a boolean field to true for each person for whom a mail
merge letter is desired.
The query reads address info from the table for each record where is
true.
|
by: nouno |
last post by:
I am trying to spell check a richtextbox. Through code (shown below) I
save the contents of the richtextbox to a rtf file, open the rtf file
in Word, spell check it, save it, and then load the ftf file back into
the ricktextbox using loadfile.
The problem is that the richtextbox seems to remain bound to the rtf
file. If I make a change in...
|
by: gaucho |
last post by:
Hi all,
I'm experiencing some problems when filling in bookmarks in word.
With my first query (single row returned), no problem at all. Yet, with
my new query (which now return 2 rows), i get some error message. -->
"Too few parameters, expected 1).
I'm having a table which describes what bookmark fits to what field. I
query this table...
|
by: Vijay |
last post by:
Hi,
I have to generate a word or rtf file on the fly whould
have a Header and footer both but i m not able to include
the header and footer in the document can anyone suggest
me how can i do that.
Currrently i am having a template of word document which
has a header ad footer and in that i m having tags which i
m replacing with my...
| |
by: Killian |
last post by:
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
|
by: Josh Asbury |
last post by:
Hi all -
I am having troubles with implementing a CommandBar in Microsoft Word
utilizing VB.net. My CommandBar appears when I start Word, but if I open an
existing document, it does not appear. My best guess is that ActiveDocument
isn't getting set correctly, but I really don't know how else to implement
this. I am attaching an external...
|
by: jpr |
last post by:
Friends,
I am having problems in exporting data from my Access db to a word
template.
On my form I have a check box named check1. On my word template a have
a box into which I need to export the value I enter in the check box.
My checkbox in word is bookmarked.
Something is not working proberly. The following code does not check
|
by: JustDucky |
last post by:
Hi!
I have a word template that utilizes a userform to gather information from the user and place it into specific Doc Variable locations within the form. If the user reopens the userform and updates the information all of the form fields are reset. My question is: How can I have only the Doc Variable information updated and not the rest of...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |