Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create a new instance of Word using ASP.NET 1

Status
Not open for further replies.

georgizas

Programmer
Sep 13, 2001
15
GR
I want to open a new instance of word in my aspx page.
I try to open, execute a macro and download to the client.
First I use this code:
Dim objWordApp As Word.Application
Dim objWordDoc As Word.Document
'Create a new instance of Word
objWordApp = New Word.Application()

'Open the document containing the macro
objWordDoc = _
objWordApp.Documents.Open("C:\Inetpub\
'Run the macro
objWordDoc.macro1 ("Hello!", 23)

But i have an security error.

Here is the details on debug windows
Exception Details: System.UnauthorizedAccessException: ??? ??????????? ? ????????.

The ASP.NET process is not authorized to access the requested resource. For security reasons the default ASP.NET process identity is '{machinename}\ASPNET', which has limited privileges. Consider granting access rights to the resource to the ASP.NET process identity.

To grant ASP.NET write access to a file, right-click the file in Explorer, choose "Properties" and select the Security tab. Click "Add" to add the "{machinename}\ASPNET" user. Highlight the ASP.NET account, and check the Write box in the Allow column.

Source Error:


Line 15: Dim objWordDoc As Word.Document
Line 16: 'Create a new instance of Word
Line 17: objWordApp = New Word.Application()
Line 18: 'Response.Redirect("Ypagvgh_g.doc")
Line 19:

But the ASPNET user has the administrator role
Can everybody help me?
 
Ok i solve the problem with the security(i make a restart my server!).
I try to open a word:
objWordDoc = _
objWordApp.Documents.Open("C:\Inetpub\
'Run the macro
objWordDoc.filldoc("Hello!")

'Close the document and clear the variables
objWordDoc.Close()

But when i try to build the project I take the error:
'Close' is ambiguous across the inherited interfaces 'Word._Document' and 'Word.DocumentEvents_Event'.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top