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 1 1645
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
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
by: Naresh1 |
last post by:
What is WebLogic Admin Training?
WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
|
by: Oralloy |
last post by:
Hello Folks,
I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA.
My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
|
by: Rahul1995seven |
last post by:
Introduction:
In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
|
by: Ricardo de Mila |
last post by:
Dear people, good afternoon...
I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control.
Than I need to discover what...
|
by: Johno34 |
last post by:
I have this click event on my form. It speaks to a Datasheet Subform
Private Sub Command260_Click()
Dim r As DAO.Recordset
Set r = Form_frmABCD.Form.RecordsetClone
r.MoveFirst
Do
If...
|
by: ezappsrUS |
last post by:
Hi,
I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...
|
by: jack2019x |
last post by:
hello, Is there code or static lib for hook swapchain present?
I wanna hook dxgi swapchain present for dx11 and dx9.
|
by: DizelArs |
last post by:
Hi all)
Faced with a problem, element.click() event doesn't work in Safari browser.
Tried various tricks like emulating touch event through a function:
let clickEvent = new Event('click', {...
|
by: F22F35 |
last post by:
I am a newbie to Access (most programming for that matter). I need help in creating an Access database that keeps the history of each user in a database. For example, a user might have lesson 1 sent...
| |