Opening Word app from Web Page

  • Thread starter Thread starter Elizabeth Harmon
  • Start date Start date
E

Elizabeth Harmon

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

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.ReleaseComObject(wrdLetter)

wrdLetter = Nothing

WrdApp.Application.Quit()

System.Runtime.InteropServices.Marshal.ReleaseComObject(WrdApp)

WrdApp = Nothing

fileName = Nothing

isVisible = Nothing

readonlyAcc = Nothing
 
Back
Top