469,625 Members | 1,859 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,625 developers. It's quick & easy.

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 1578
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Jason Steeves | last post: by
2 posts views Thread by DigitalFusion | last post: by
reply views Thread by =?Utf-8?B?V2FubmFiZQ==?= | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.