473,320 Members | 1,612 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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.ApplicationClass

Public wrdLetter As Word.Document

In Private Sub :

If WrdApp Is Nothing Then
WrdApp = New Word.ApplicationClass

WrdApp.Visible = True

WrdApp.WindowState=Word.WdWindowState.wdWindowStat eMaximize

End If

wrdLetter = New Word.Document

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

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

Dim NewFileName As String = strPatientName.Replace(" ", "-").ToString() &
CStr(FormatDateTime(Date.Now, DateFormat.ShortDate)).Replace("/", "-") &
strUniqId.Replace(":", "-") & ".doc"

Dim missing As Object

missing = System.Reflection.Missing.Value

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

wrdLetter.Activate()

wrdLetter.Bookmarks.Item("TodayDate").Range.Text =
FormatDateTime(Date.Now(), DateFormat.ShortDate)

wrdLetter.Bookmarks.Item("PatientNM").Range.Text = strPatientName

wrdLetter.Bookmarks.Item("SSN").Range.Text = strPatientSSN

wrdLetter.Bookmarks.Item("PCP").Range.Text = strEval

wrdLetter.Bookmarks.Item("Location").Range.Text = strLocationName

wrdLetter.Bookmarks.Item("TeacherNM").Range.Text = strTeacherName

wrdLetter.SaveAs(strNewFilePath & NewFileName)

wrdLetter.PrintPreview()

'WrdApp_DocumentBeforeClose(wrdLetter, False)

wrdLetter.Close()

System.Runtime.InteropServices.Marshal.ReleaseComO bject(wrdLetter)

wrdLetter = Nothing

WrdApp.Application.Quit()

System.Runtime.InteropServices.Marshal.ReleaseComO bject(WrdApp)

WrdApp = Nothing

fileName = Nothing

isVisible = Nothing

readonlyAcc = Nothing
Nov 18 '05 #1
1 1694
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*****@bloomingtonfarms.com> wrote in message
news:en**************@TK2MSFTNGP11.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.ApplicationClass

Public wrdLetter As Word.Document

In Private Sub :

If WrdApp Is Nothing Then
WrdApp = New Word.ApplicationClass

WrdApp.Visible = True

WrdApp.WindowState=Word.WdWindowState.wdWindowStat eMaximize

End If

wrdLetter = New Word.Document

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

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

Dim NewFileName As String = strPatientName.Replace(" ", "-").ToString() &
CStr(FormatDateTime(Date.Now, DateFormat.ShortDate)).Replace("/", "-") &
strUniqId.Replace(":", "-") & ".doc"

Dim missing As Object

missing = System.Reflection.Missing.Value

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

wrdLetter.Activate()

wrdLetter.Bookmarks.Item("TodayDate").Range.Text =
FormatDateTime(Date.Now(), DateFormat.ShortDate)

wrdLetter.Bookmarks.Item("PatientNM").Range.Text = strPatientName

wrdLetter.Bookmarks.Item("SSN").Range.Text = strPatientSSN

wrdLetter.Bookmarks.Item("PCP").Range.Text = strEval

wrdLetter.Bookmarks.Item("Location").Range.Text = strLocationName

wrdLetter.Bookmarks.Item("TeacherNM").Range.Text = strTeacherName

wrdLetter.SaveAs(strNewFilePath & NewFileName)

wrdLetter.PrintPreview()

'WrdApp_DocumentBeforeClose(wrdLetter, False)

wrdLetter.Close()

System.Runtime.InteropServices.Marshal.ReleaseComO bject(wrdLetter)

wrdLetter = Nothing

WrdApp.Application.Quit()

System.Runtime.InteropServices.Marshal.ReleaseComO bject(WrdApp)

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
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...
6
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...
44
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...
3
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...
0
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...
7
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...
2
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...
4
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...
0
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...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.