473,609 Members | 1,868 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Open Word Doc from asp

I got the following code from a website somewhere. When I try to run it I
get the error - Activex component can't create object "Word.Applicati on".

It is running on localhost and test2.doc does exist.

What have I missed?

<HTML>
<HEAD>
<SCRIPT LANGUAGE=VBScri pt>
Dim objWord
Sub Btn1_onclick()
call OpenDoc("Test2. doc")
End Sub
Sub OpenDoc(strLoca tion)
Set objWord = CreateObject("W ord.Application ")
objWord.Visible = true
objWord.Documen ts.Open strLocation
End Sub
</SCRIPT>
<TITLE>Launch Word</Title>
</HEAD>
<BODY>
<INPUT TYPE=BUTTON NAME=Btn1 VALUE="Open Word Doc">
</BODY>
</HTML>
Jul 19 '05 #1
2 4334
On Wed, 12 May 2004 15:10:24 +0100, "Anne Richmond"
<an***********@ bradford.gov.uk > wrote:
I got the following code from a website somewhere. When I try to run it I
get the error - Activex component can't create object "Word.Applicati on".

It is running on localhost and test2.doc does exist.

What have I missed?
Is Word installed...? :)

The Office web components should also be installed for this method I
believe.

Jeff
<HTML>
<HEAD>
<SCRIPT LANGUAGE=VBScri pt>
Dim objWord
Sub Btn1_onclick()
call OpenDoc("Test2. doc")
End Sub
Sub OpenDoc(strLoca tion)
Set objWord = CreateObject("W ord.Application ")
objWord.Visibl e = true
objWord.Docume nts.Open strLocation
End Sub
</SCRIPT>
<TITLE>Launc h Word</Title>
</HEAD>
<BODY>
<INPUT TYPE=BUTTON NAME=Btn1 VALUE="Open Word Doc">
</BODY>
</HTML>


Jul 19 '05 #2
Where is Test2.doc? You don't have a path at all, and I bet it's not in the
users Temporary Internet Files.
have you lowered your security settings to allow this?
"Anne Richmond" <an***********@ bradford.gov.uk > wrote in message
news:36******** ************@ka roo.co.uk...
I got the following code from a website somewhere. When I try to run it I
get the error - Activex component can't create object "Word.Applicati on".

It is running on localhost and test2.doc does exist.

What have I missed?

<HTML>
<HEAD>
<SCRIPT LANGUAGE=VBScri pt>
Dim objWord
Sub Btn1_onclick()
call OpenDoc("Test2. doc")
End Sub
Sub OpenDoc(strLoca tion)
Set objWord = CreateObject("W ord.Application ")
objWord.Visible = true
objWord.Documen ts.Open strLocation
End Sub
</SCRIPT>
<TITLE>Launch Word</Title>
</HEAD>
<BODY>
<INPUT TYPE=BUTTON NAME=Btn1 VALUE="Open Word Doc">
</BODY>
</HTML>

Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
4521
by: Martin Lucas-Smith | last post by:
I am trying to use PHP's COM support to open a URL from within MS Word then save the document. I am using PHP5.0.3/Apache2/WindowsXP. phpinfo() confirms that COM support is enabled. Manually, this would be: - Start MS Word (am using Office 2003)
3
4905
by: TLMM | last post by:
I have a Word doc already created that I want to open from an asp page. I want it to open in Word and allow the user to modify if necessary. I currently have it opening (using href), but it is opening in IE. I think I should be able to do it with javascript to open word and then call that function on the link to the doc. Can someone give me some pointers? Thanks in advance.
3
5806
by: Andy Davis | last post by:
How do i or can I open a word document directly from Access? I would like to be able for the user to click a button on my form to open a word document and then also run a macro in Word. Thanks in advance
8
3170
by: sudha | last post by:
Hi, To open a word doc from c#, i use the following code : Word.ApplicationClass WordApp = new Word.ApplicationClass (); // give any file name of your choice. object fileName = "C:\\test.doc"; object readOnly = false;
10
2636
by: Åženol Akbulak | last post by:
Hi, I have a form page to print on my web application(asp.net). I want to show the page in WORD. I use that code in asp.net Page_Load event: Response.Clear(); Response.ContentType = "application/ms-word"; Response.AddHeader("Content-Disposition", "attachment;filename=word.doc"); When I open the page in IE shows a dialog to ask whether I want to open or save. It is ok. But when I click Open or Save button, I get an error message:
4
18632
by: Fabian | last post by:
Hello, I want to open a Word Document in my C# Programm. I tried this : Word.Application wordapp = new Word.Application(); object path = "TEST.DOC"; object vk_read_only = false; object vk_visible = true; object vk_false = false; object vk_true = true;
0
3220
by: Niyazi | last post by:
Hi, I created application that store the data in SQL SERVER that reside on network. The client also use this application to access the resources provided with application. But is the client want to register new customer or companies they will enter the information in Windows Form and the program automaticaly creates the WORD document under specific folder under application path. Once the empty word file created than ask user if they want...
6
2641
by: Bob Alston | last post by:
Looking for someone with experience building apps with multiple instances of forms open. I am building an app for a nonprofit organizations case workers. They provide services to the elderly. so far I have built a traditional app, switchboard, forms, etc. Part of this app is to automate the forms they previously prepared manually. After the app was built and works just fine, I find out there are several case managers using MS word...
0
2540
by: RKovach | last post by:
I am automating Word and getting the existing instance if available using the following: Word.Application oWord = null; Word.Document oDoc = null; object oMissing = System.Reflection.Missing.Value; object sFN = @"C:\Test\TestDoc.doc"; try {
7
4000
by: Peter | last post by:
ASP.NET 2.0 I am trying to open a Word document and Excel document from a dialog web page, what's the best way to do that? I have tried the following: Response.Clear(); Response.AddHeader("Content-Disposition", "attachment; filename=" + file.Name);
0
8139
marktang
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8091
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8579
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8555
jinu1996
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8232
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
8408
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6064
isladogs
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5524
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
1403
bsmnconsultancy
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.