By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,825 Members | 1,708 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,825 IT Pros & Developers. It's quick & easy.

Windows2000,Word2003,ASP.Net - Help

P: n/a
Hi All

I am attempting to open a Word App from a web page on the client 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
Share this Question
Share on Google+
10 Replies


P: n/a
This is typically an identity issue. If you mess with DCOMCNFG and you
want a GUI to pop up, make sure the application is run by "the interactive
user". You can set this on the Identity tab of DCOMCNFG properties.

From a DCOM perspective, the interactive user "owns" the GUI, hence
any (pseudo-)remote clients will not get access to the GUI when calling
services with their own identity.
"Elizabeth Harmon" <Jd*****@helthchoice.com> wrote in message
news:em**************@tk2msftngp13.phx.gbl...
Hi All

I am attempting to open a Word App from a web page on the client 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

P: n/a
Does this mean that i should Make the ASP_NET user or the IUSR_MAchineName
part of another group that has rights to Use the GUI and Application?

Thanks in advance
Samantha
"Martin" <du***@somewhere.nl> wrote in message
news:3f*********************@dreader8.news.xs4all. nl...
This is typically an identity issue. If you mess with DCOMCNFG and you
want a GUI to pop up, make sure the application is run by "the interactive
user". You can set this on the Identity tab of DCOMCNFG properties.

From a DCOM perspective, the interactive user "owns" the GUI, hence
any (pseudo-)remote clients will not get access to the GUI when calling
services with their own identity.
"Elizabeth Harmon" <Jd*****@helthchoice.com> wrote in message
news:em**************@tk2msftngp13.phx.gbl...
Hi All

I am attempting to open a Word App from a web page on the client 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 #3

P: n/a
Samantha,

I am not quite sure what you are trying to do, the problem just sounded
familiar and I guessed I would put you on the right track by telling you
about the identity of the launching user. Perhaps I just sent you further
into the woods.
Does this mean that i should Make the ASP_NET user or the IUSR_MAchineName
part of another group that has rights to Use the GUI and Application?
I don't think you can delegate the right to use the GUI to anyone but the
logged on user. This is why the very action is delegated to the logged on
user.

Re-reading your earlier message I understand you want to open a Word
document (which is located on the server) on the client, outside of your
browser, by automating Word through client side script.

If this is the case, IUSR_MachineName isn't of much use since it lives on
the server. The client side script code should be executed under your
visitor's account, the one that started the browser, which is the
interactive user on the client side. I don't see an identity issue there.

Now I believe the problem is in the way you address word from script. There
should be a method or property on the "Word.Application" object that tells
it to show a GUI or not.

http://msdn.microsoft.com/library/de...properties.asp

Try theVisible property and forget about DCOMCNFG altogether..

"Elizabeth Harmon" <Jd*****@helthchoice.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl... Does this mean that i should Make the ASP_NET user or the IUSR_MAchineName
part of another group that has rights to Use the GUI and Application?

Thanks in advance
Samantha
"Martin" <du***@somewhere.nl> wrote in message
news:3f*********************@dreader8.news.xs4all. nl...
This is typically an identity issue. If you mess with DCOMCNFG and you
want a GUI to pop up, make sure the application is run by "the interactive
user". You can set this on the Identity tab of DCOMCNFG properties.

From a DCOM perspective, the interactive user "owns" the GUI, hence
any (pseudo-)remote clients will not get access to the GUI when calling
services with their own identity.
"Elizabeth Harmon" <Jd*****@helthchoice.com> wrote in message
news:em**************@tk2msftngp13.phx.gbl...
Hi All

I am attempting to open a Word App from a web page on the client 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 #4

P: n/a
> The client side script code should be executed under your
visitor's account, the one that started the browser, which is the
interactive user on the client side. I don't see an identity issue there.


This had better not be true since it would enable a web site developer
to erase the visitor's local hard disk using client side script. I am not
too confident in this area. Anyway, check out that Visible
property.

Martin.
Nov 18 '05 #5

P: n/a
Martin

Thanks for your help.

I am passing back information From the Server to a web page, and then
Opening Word on the Client side and then filling bookmarks on the Word
Template that is located on the Client in an intranet website, with the code
below:

************************************************** ***************
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)

************************************************** **************************
*****

I can send the information, the word doc file gets its bookmarks filled and
it is saved on the local client, the only thing missing is the GUI of Word
which never appears to become visible even though i issue a Visible = true
propety of the Word App.

What i want is for the User to see the document so they can review it or
make any changes to the document. I have disabled the interactive user for
an indentity that has full rights to the Client machine, i just dont
understand why the Visible property is not being understood.

Thanks in advance
Samantha

"Martin" <du***@somewhere.nl> wrote in message
news:3f*********************@dreader8.news.xs4all. nl...
The client side script code should be executed under your
visitor's account, the one that started the browser, which is the
interactive user on the client side. I don't see an identity issue
there.
This had better not be true since it would enable a web site developer
to erase the visitor's local hard disk using client side script. I am not
too confident in this area. Anyway, check out that Visible
property.

Martin.

Nov 18 '05 #6

P: n/a
Okay, here's another thought.

You seem to start Word as a COM server by obtainig an interface. Then you
talk to the interface and I presume the client side script runs out of scope
at some point. That would be the time for the script interpreter to release
the interface if you had not done so yourself by setting your WrdApp to
Nothing. Word would notice there are no COM clients left and would
terminate. The whole thing could be going so fast that you would never see
the Word GUI.

If this is indeed what is happening, it would help to just start Word before
the firt interface is obtained through

WrdApp = New Word.ApplicationClass
Does it work the way you want it to if Word is already up before the script
kicks in? If so, you need to have the script start a Word instance if it not
already there. I don't want to start thinking about how to do that yet.

Better yet would be to have some sort of client side session object to store
your WrdApp in , preventing it from running out of scope.

I hope this makes any sense.

Martin.
"Elizabeth Harmon" <Jd*****@helthchoice.com> wrote in message
news:OF**************@TK2MSFTNGP11.phx.gbl...
Martin

Thanks for your help.

I am passing back information From the Server to a web page, and then
Opening Word on the Client side and then filling bookmarks on the Word
Template that is located on the Client in an intranet website, with the code below:

************************************************** ***************
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)

************************************************** ************************** *****

I can send the information, the word doc file gets its bookmarks filled and it is saved on the local client, the only thing missing is the GUI of Word
which never appears to become visible even though i issue a Visible = true
propety of the Word App.

What i want is for the User to see the document so they can review it or
make any changes to the document. I have disabled the interactive user for
an indentity that has full rights to the Client machine, i just dont
understand why the Visible property is not being understood.

Thanks in advance
Samantha

"Martin" <du***@somewhere.nl> wrote in message
news:3f*********************@dreader8.news.xs4all. nl...
The client side script code should be executed under your
visitor's account, the one that started the browser, which is the
interactive user on the client side. I don't see an identity issue there.

This had better not be true since it would enable a web site developer
to erase the visitor's local hard disk using client side script. I am

not too confident in this area. Anyway, check out that Visible
property.

Martin.


Nov 18 '05 #7

P: n/a
Martin

It may be the case that the word object is coming and going so fast that i
just dont see it, I may have to use some form of thread.sleep() to hold it
open for a bit. I am getting everything accomplished except a visual on
word, the letter is made and saved complete with passsed information, I just
never see it.

Thanks for your help

I'll get back with you
Samantha
"Martin" <du***@somewhere.nl> wrote in message
news:3f*********************@dreader4.news.xs4all. nl...
Okay, here's another thought.

You seem to start Word as a COM server by obtainig an interface. Then you
talk to the interface and I presume the client side script runs out of scope at some point. That would be the time for the script interpreter to release the interface if you had not done so yourself by setting your WrdApp to
Nothing. Word would notice there are no COM clients left and would
terminate. The whole thing could be going so fast that you would never see
the Word GUI.

If this is indeed what is happening, it would help to just start Word before the firt interface is obtained through

WrdApp = New Word.ApplicationClass
Does it work the way you want it to if Word is already up before the script kicks in? If so, you need to have the script start a Word instance if it not already there. I don't want to start thinking about how to do that yet.

Better yet would be to have some sort of client side session object to store your WrdApp in , preventing it from running out of scope.

I hope this makes any sense.

Martin.
"Elizabeth Harmon" <Jd*****@helthchoice.com> wrote in message
news:OF**************@TK2MSFTNGP11.phx.gbl...
Martin

Thanks for your help.

I am passing back information From the Server to a web page, and then
Opening Word on the Client side and then filling bookmarks on the Word
Template that is located on the Client in an intranet website, with the

code
below:

************************************************** ***************
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)

************************************************** **************************
*****

I can send the information, the word doc file gets its bookmarks filled

and
it is saved on the local client, the only thing missing is the GUI of Word which never appears to become visible even though i issue a Visible = true propety of the Word App.

What i want is for the User to see the document so they can review it or
make any changes to the document. I have disabled the interactive user for an indentity that has full rights to the Client machine, i just dont
understand why the Visible property is not being understood.

Thanks in advance
Samantha

"Martin" <du***@somewhere.nl> wrote in message
news:3f*********************@dreader8.news.xs4all. nl...
> The client side script code should be executed under your
> visitor's account, the one that started the browser, which is the
> interactive user on the client side. I don't see an identity issue

there.

This had better not be true since it would enable a web site developer
to erase the visitor's local hard disk using client side script. I am

not too confident in this area. Anyway, check out that Visible
property.

Martin.



Nov 18 '05 #8

P: n/a
Changing the COM User to The Interactive User Worked and the Word app
appeared like i needed so thanks for all your help

Samantha
"Elizabeth Harmon" <Jd*****@helthchoice.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Martin

It may be the case that the word object is coming and going so fast that i
just dont see it, I may have to use some form of thread.sleep() to hold it
open for a bit. I am getting everything accomplished except a visual on
word, the letter is made and saved complete with passsed information, I just never see it.

Thanks for your help

I'll get back with you
Samantha
"Martin" <du***@somewhere.nl> wrote in message
news:3f*********************@dreader4.news.xs4all. nl...
Okay, here's another thought.

You seem to start Word as a COM server by obtainig an interface. Then you
talk to the interface and I presume the client side script runs out of scope
at some point. That would be the time for the script interpreter to

release
the interface if you had not done so yourself by setting your WrdApp to
Nothing. Word would notice there are no COM clients left and would
terminate. The whole thing could be going so fast that you would never see the Word GUI.

If this is indeed what is happening, it would help to just start Word

before
the firt interface is obtained through

WrdApp = New Word.ApplicationClass
Does it work the way you want it to if Word is already up before the

script
kicks in? If so, you need to have the script start a Word instance if it

not
already there. I don't want to start thinking about how to do that yet.

Better yet would be to have some sort of client side session object to

store
your WrdApp in , preventing it from running out of scope.

I hope this makes any sense.

Martin.
"Elizabeth Harmon" <Jd*****@helthchoice.com> wrote in message
news:OF**************@TK2MSFTNGP11.phx.gbl...
Martin

Thanks for your help.

I am passing back information From the Server to a web page, and then
Opening Word on the Client side and then filling bookmarks on the Word
Template that is located on the Client in an intranet website, with the
code
below:

************************************************** ***************
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)

************************************************** **************************
*****

I can send the information, the word doc file gets its bookmarks filled and
it is saved on the local client, the only thing missing is the GUI of Word which never appears to become visible even though i issue a Visible = true propety of the Word App.

What i want is for the User to see the document so they can review it
or make any changes to the document. I have disabled the interactive user for an indentity that has full rights to the Client machine, i just dont
understand why the Visible property is not being understood.

Thanks in advance
Samantha

"Martin" <du***@somewhere.nl> wrote in message
news:3f*********************@dreader8.news.xs4all. nl...
> > The client side script code should be executed under your
> > visitor's account, the one that started the browser, which is the
> > interactive user on the client side. I don't see an identity issue
there.
>
> This had better not be true since it would enable a web site developer > to erase the visitor's local hard disk using client side script. I

am not
> too confident in this area. Anyway, check out that Visible
> property.
>
> Martin.
>
>



Nov 18 '05 #9

P: n/a
Samantha,
Changing the COM User to The Interactive User worked
Groovy. Note that if you need to configure this for several workstations you
can do so automatically by changing the registry according to the following
import file:

---------------------------------------
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\AppID\{00020906-0000-0000-C000-000000000046}]
@="Microsoft Word Document"
"AuthenticationLevel"=dword:00000000
"RunAs"="Interactive User"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\AppID\{0002090 6-0000-0000-C000-00000000
0046}]
@="Microsoft Word Document"
"AuthenticationLevel"=dword:00000000
"RunAs"="Interactive User"
---------------------------------------

I assume the GUID will be identical for different Word versions but you may
want to verify that (I copied it from the DCOMCNFG's property window's
General tab and did a search for it in the registry). Launching user is
default, if you change it in the GUI and hit F5 in RegEdit you will see the
new setting appear.

Martin.
"Elizabeth Harmon" <EH*****@bloomingtonfarms.com> wrote in message
news:uV**************@TK2MSFTNGP09.phx.gbl... Changing the COM User to The Interactive User Worked and the Word app
appeared like i needed so thanks for all your help

Samantha
"Elizabeth Harmon" <Jd*****@helthchoice.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Martin

It may be the case that the word object is coming and going so fast that i
just dont see it, I may have to use some form of thread.sleep() to hold it open for a bit. I am getting everything accomplished except a visual on
word, the letter is made and saved complete with passsed information, I just
never see it.

Thanks for your help

I'll get back with you
Samantha
"Martin" <du***@somewhere.nl> wrote in message
news:3f*********************@dreader4.news.xs4all. nl...
Okay, here's another thought.

You seem to start Word as a COM server by obtainig an interface. Then you talk to the interface and I presume the client side script runs out of

scope
at some point. That would be the time for the script interpreter to

release
the interface if you had not done so yourself by setting your WrdApp to Nothing. Word would notice there are no COM clients left and would
terminate. The whole thing could be going so fast that you would never see the Word GUI.

If this is indeed what is happening, it would help to just start Word

before
the firt interface is obtained through

WrdApp = New Word.ApplicationClass
Does it work the way you want it to if Word is already up before the

script
kicks in? If so, you need to have the script start a Word instance if it not
already there. I don't want to start thinking about how to do that
yet.
Better yet would be to have some sort of client side session object to

store
your WrdApp in , preventing it from running out of scope.

I hope this makes any sense.

Martin.
"Elizabeth Harmon" <Jd*****@helthchoice.com> wrote in message
news:OF**************@TK2MSFTNGP11.phx.gbl...
> Martin
>
> Thanks for your help.
>
> I am passing back information From the Server to a web page, and then > Opening Word on the Client side and then filling bookmarks on the Word > Template that is located on the Client in an intranet website, with the code
> below:
>
> ************************************************** ***************
> 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)
>
>

************************************************** ************************** > *****
>
> I can send the information, the word doc file gets its bookmarks filled and
> it is saved on the local client, the only thing missing is the GUI of Word
> which never appears to become visible even though i issue a Visible
=
true
> propety of the Word App.
>
> What i want is for the User to see the document so they can review
it or > make any changes to the document. I have disabled the interactive
user for
> an indentity that has full rights to the Client machine, i just dont
> understand why the Visible property is not being understood.
>
> Thanks in advance
> Samantha
>
> "Martin" <du***@somewhere.nl> wrote in message
> news:3f*********************@dreader8.news.xs4all. nl...
> > > The client side script code should be executed under your
> > > visitor's account, the one that started the browser, which is

the > > > interactive user on the client side. I don't see an identity issue > there.
> >
> > This had better not be true since it would enable a web site

developer > > to erase the visitor's local hard disk using client side script. I am not
> > too confident in this area. Anyway, check out that Visible
> > property.
> >
> > Martin.
> >
> >
>
>



Nov 18 '05 #10

P: n/a
thanks again Martin!!
"Martin" <du***@somewhere.nl> wrote in message
news:3f***********************@dreader11.xs4all.nl ...
Samantha,
Changing the COM User to The Interactive User worked
Groovy. Note that if you need to configure this for several workstations

you can do so automatically by changing the registry according to the following import file:

---------------------------------------
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\AppID\{00020906-0000-0000-C000-000000000046}]
@="Microsoft Word Document"
"AuthenticationLevel"=dword:00000000
"RunAs"="Interactive User"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\AppID\{0002090 6-0000-0000-C000-00000000 0046}]
@="Microsoft Word Document"
"AuthenticationLevel"=dword:00000000
"RunAs"="Interactive User"
---------------------------------------

I assume the GUID will be identical for different Word versions but you may want to verify that (I copied it from the DCOMCNFG's property window's
General tab and did a search for it in the registry). Launching user is
default, if you change it in the GUI and hit F5 in RegEdit you will see the new setting appear.

Martin.
"Elizabeth Harmon" <EH*****@bloomingtonfarms.com> wrote in message
news:uV**************@TK2MSFTNGP09.phx.gbl...
Changing the COM User to The Interactive User Worked and the Word app
appeared like i needed so thanks for all your help

Samantha
"Elizabeth Harmon" <Jd*****@helthchoice.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Martin

It may be the case that the word object is coming and going so fast that
i
just dont see it, I may have to use some form of thread.sleep() to
hold
it open for a bit. I am getting everything accomplished except a visual
on word, the letter is made and saved complete with passsed information, I
just
never see it.

Thanks for your help

I'll get back with you
Samantha
"Martin" <du***@somewhere.nl> wrote in message
news:3f*********************@dreader4.news.xs4all. nl...
> Okay, here's another thought.
>
> You seem to start Word as a COM server by obtainig an interface.
Then you
> talk to the interface and I presume the client side script runs out
of scope
> at some point. That would be the time for the script interpreter to
release
> the interface if you had not done so yourself by setting your WrdApp
to > Nothing. Word would notice there are no COM clients left and would
> terminate. The whole thing could be going so fast that you would never see
> the Word GUI.
>
> If this is indeed what is happening, it would help to just start
Word before
> the firt interface is obtained through
>
> WrdApp = New Word.ApplicationClass
>
>
> Does it work the way you want it to if Word is already up before the
script
> kicks in? If so, you need to have the script start a Word instance if it not
> already there. I don't want to start thinking about how to do that yet. >
> Better yet would be to have some sort of client side session object
to store
> your WrdApp in , preventing it from running out of scope.
>
> I hope this makes any sense.
>
> Martin.
>
>
> "Elizabeth Harmon" <Jd*****@helthchoice.com> wrote in message
> news:OF**************@TK2MSFTNGP11.phx.gbl...
> > Martin
> >
> > Thanks for your help.
> >
> > I am passing back information From the Server to a web page, and then > > Opening Word on the Client side and then filling bookmarks on the Word > > Template that is located on the Client in an intranet website, with the
> code
> > below:
> >
> > ************************************************** ***************
> > 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)
> >
> >
>

************************************************** ************************** > > *****
> >
> > I can send the information, the word doc file gets its bookmarks

filled
> and
> > it is saved on the local client, the only thing missing is the GUI of Word
> > which never appears to become visible even though i issue a Visible =
true
> > propety of the Word App.
> >
> > What i want is for the User to see the document so they can review it
or
> > make any changes to the document. I have disabled the interactive

user for
> > an indentity that has full rights to the Client machine, i just
dont > > understand why the Visible property is not being understood.
> >
> > Thanks in advance
> > Samantha
> >
> > "Martin" <du***@somewhere.nl> wrote in message
> > news:3f*********************@dreader8.news.xs4all. nl...
> > > > The client side script code should be executed under your
> > > > visitor's account, the one that started the browser, which is

the > > > > interactive user on the client side. I don't see an identity issue > > there.
> > >
> > > This had better not be true since it would enable a web site

developer
> > > to erase the visitor's local hard disk using client side script.

I am
> not
> > > too confident in this area. Anyway, check out that Visible
> > > property.
> > >
> > > Martin.
> > >
> > >
> >
> >
>
>



Nov 18 '05 #11

This discussion thread is closed

Replies have been disabled for this discussion.