473,545 Members | 2,451 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Opening Word app from Web Page

Hi All

I am attempting to open a Word App from a web page and so far everything
works (After reconfig of dcomcnfg for Microsoft Word Document). I have one
minor problem, i cannot get the application to become visible
**********What am i doing wrong? is there something else that needs to be
done to make the application visible? I am using windows 2000 and Word 2002

thanks in advance

Samantha

Below is the Code i am using:
Class Declarations:

Public WrdApp As Word.Applicatio nClass

Public wrdLetter As Word.Document

In Private Sub :

If WrdApp Is Nothing Then
WrdApp = New Word.Applicatio nClass

WrdApp.Visible = True

WrdApp.WindowSt ate=Word.WdWind owState.wdWindo wStateMaximize

End If

wrdLetter = New Word.Document

Dim strNewFilePath As String = "C:\Temp\"

Dim strUniqId As String = Date.Now.Hour.T oString() &
Date.Now.Minute .ToString()

Dim NewFileName As String = strPatientName. Replace(" ", "-").ToString () &
CStr(FormatDate Time(Date.Now, DateFormat.Shor tDate)).Replace ("/", "-") &
strUniqId.Repla ce(":", "-") & ".doc"

Dim missing As Object

missing = System.Reflecti on.Missing.Valu e

wrdLetter = WrdApp.Document s.Open(fileName , missing, readonlyAcc, True,
missing, missing, missing, missing, missing, missing, missing, isVisible,
missing, missing)

wrdLetter.Activ ate()

wrdLetter.Bookm arks.Item("Toda yDate").Range.T ext =
FormatDateTime( Date.Now(), DateFormat.Shor tDate)

wrdLetter.Bookm arks.Item("Pati entNM").Range.T ext = strPatientName

wrdLetter.Bookm arks.Item("SSN" ).Range.Text = strPatientSSN

wrdLetter.Bookm arks.Item("PCP" ).Range.Text = strEval

wrdLetter.Bookm arks.Item("Loca tion").Range.Te xt = strLocationName

wrdLetter.Bookm arks.Item("Teac herNM").Range.T ext = strTeacherName

wrdLetter.SaveA s(strNewFilePat h & NewFileName)

wrdLetter.Print Preview()

'WrdApp_Documen tBeforeClose(wr dLetter, False)

wrdLetter.Close ()

System.Runtime. InteropServices .Marshal.Releas eComObject(wrdL etter)

wrdLetter = Nothing

WrdApp.Applicat ion.Quit()

System.Runtime. InteropServices .Marshal.Releas eComObject(WrdA pp)

WrdApp = Nothing

fileName = Nothing

isVisible = Nothing

readonlyAcc = Nothing
Nov 18 '05 #1
1 1707
Are you trying to get Word to appear on the server or on the client?
This article demonstrates ways to interact with Excel & Word:
http://www.aspnetpro.com/NewsletterA...200309so_l.asp

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
Hire top-notch developers at http://www.able-consulting.com

"Elizabeth Harmon" <EH*****@bloomi ngtonfarms.com> wrote in message
news:en******** ******@TK2MSFTN GP11.phx.gbl...
Hi All

I am attempting to open a Word App from a web page and so far everything
works (After reconfig of dcomcnfg for Microsoft Word Document). I have one
minor problem, i cannot get the application to become visible
**********What am i doing wrong? is there something else that needs to be
done to make the application visible? I am using windows 2000 and Word 2002
thanks in advance

Samantha

Below is the Code i am using:
Class Declarations:

Public WrdApp As Word.Applicatio nClass

Public wrdLetter As Word.Document

In Private Sub :

If WrdApp Is Nothing Then
WrdApp = New Word.Applicatio nClass

WrdApp.Visible = True

WrdApp.WindowSt ate=Word.WdWind owState.wdWindo wStateMaximize

End If

wrdLetter = New Word.Document

Dim strNewFilePath As String = "C:\Temp\"

Dim strUniqId As String = Date.Now.Hour.T oString() &
Date.Now.Minute .ToString()

Dim NewFileName As String = strPatientName. Replace(" ", "-").ToString () &
CStr(FormatDate Time(Date.Now, DateFormat.Shor tDate)).Replace ("/", "-") &
strUniqId.Repla ce(":", "-") & ".doc"

Dim missing As Object

missing = System.Reflecti on.Missing.Valu e

wrdLetter = WrdApp.Document s.Open(fileName , missing, readonlyAcc, True,
missing, missing, missing, missing, missing, missing, missing, isVisible,
missing, missing)

wrdLetter.Activ ate()

wrdLetter.Bookm arks.Item("Toda yDate").Range.T ext =
FormatDateTime( Date.Now(), DateFormat.Shor tDate)

wrdLetter.Bookm arks.Item("Pati entNM").Range.T ext = strPatientName

wrdLetter.Bookm arks.Item("SSN" ).Range.Text = strPatientSSN

wrdLetter.Bookm arks.Item("PCP" ).Range.Text = strEval

wrdLetter.Bookm arks.Item("Loca tion").Range.Te xt = strLocationName

wrdLetter.Bookm arks.Item("Teac herNM").Range.T ext = strTeacherName

wrdLetter.SaveA s(strNewFilePat h & NewFileName)

wrdLetter.Print Preview()

'WrdApp_Documen tBeforeClose(wr dLetter, False)

wrdLetter.Close ()

System.Runtime. InteropServices .Marshal.Releas eComObject(wrdL etter)

wrdLetter = Nothing

WrdApp.Applicat ion.Quit()

System.Runtime. InteropServices .Marshal.Releas eComObject(WrdA pp)

WrdApp = Nothing

fileName = Nothing

isVisible = Nothing

readonlyAcc = Nothing

Nov 18 '05 #2

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

Similar topics

0
3992
by: Sivaraman.S | last post by:
Issue: When I am opening a word document or a template from an ASP.NET Web page (language used VB.NET Visual Studio Version 2003) using Word.ApplicationClass object (Reference Word 11.0 object Library), I am getting the following error: could not open macro storage (System.Runtime.comExeception) I am not getting any errors while opening...
6
3845
by: Jason Steeves | last post by:
I am hoping someone can tell me how, or point me in the right direction for the following problem. I need to have word open a specified file, .mht, as a plug-in inside of IE so that I can edit this file within the word plugin within IE. I am not even sure how I can get this to work with a .doc file. I appreciate any help you can...
44
4674
by: Carlos Andr?s | last post by:
Hi everybody. I've got a problem. I'd like to avoid opening a new window when you have pressed the shift key and you click in the left button of the mouse. I've tried the next solution, in the body of the page I put the next code: <BODY onkeydown='notOpenNewWindow();'>
3
5570
by: Andy Davis | last post by:
I have set up a mail merge document in Word 2003 which gets its data from my Access 2000 database. I want to set up a button on a form that: 1. runs the query to provide the dat for the merge document in Word; 2. opens the document and runs the merge process for the new data. I have managed to write the code to perform step 1 ok, but I'm...
0
4901
by: Sivaraman.S | last post by:
Issue : When I am trying to open a Word Document or a Template from a Web Application (ASP.NET Web page - Language Used VB.NET Visual Studio Version 2003) using Word.ApplicationClass (Refering Word 11.0 Library), I am getting the following Errror: Could not open Macro storage. (System.Runtime.ComExeception) When I am Opening the word...
7
3204
by: mkorch17 | last post by:
Hello, I have a server with a Word document and an Access database on it. I also have an ASP page running on the server. The Word document contains a mail merge with the Access database. What I want to do is open the merged Word document from the ASP page when a button is clicked. I have tried several things including some scripting...
2
1679
by: DigitalFusion | last post by:
Hello All, I have an app on an intranet which uses the response.contenttype in ASP to create a word doc. The issue I am having is that when this doc is generated and opened, the session is lost. We have tried everything up to this point, setting timeout in IIS, refresh scripts, etc, until we realized it has something to to do with the...
4
2125
by: sunil | last post by:
Hi, I have to open a word document from my aspx page.The Page_Load method contains the following code System.IO.TextWriter tx = Response.Output; System.IO.StreamReader sr = new System.IO.StreamReader(this.Path); Response.ContentType = "application/msword"; tx.Write(sr.ReadToEnd()); sr.Close();
0
1636
by: =?Utf-8?B?V2FubmFiZQ==?= | last post by:
I am creating a webpage and opening it as a Word document. Problem is that as I create one of the questions, some of the text is not appearing in the document as it should. As I step through it, I can see the text in my string builder variable, but once the page opens as a Word document, that same text is not showing. It seems to only be text...
0
7487
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...
0
7778
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...
0
6003
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5349
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...
0
4966
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...
0
3476
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...
0
3459
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1908
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
1
1033
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.