CreateObject("word.Application")

M

Microsoft

I'm trying to display a word document inside a web page, but everytime I do
I get this error:

Error Type:
Microsoft VBScript runtime (0x800A0046)
Permission denied: 'CreateObject'

Does anybody know the correct way to do this? I don't want to link to a
document, but rather display a word file inside the asp page.

Any help will be greatly appreciated!

Clay
(e-mail address removed)
 
T

Tom Kaminski [MVP]

Microsoft said:
I'm trying to display a word document inside a web page, but everytime I do
I get this error:

Error Type:
Microsoft VBScript runtime (0x800A0046)
Permission denied: 'CreateObject'

Does anybody know the correct way to do this? I don't want to link to a
document, but rather display a word file inside the asp page.

Any help will be greatly appreciated!

You can't really "display a word file inside the asp page". You could
simulate it using an IFRAME perhaps.
 
M

Microsoft

I'm creating a page that pulls a document from a server. The whole concept
is for ISO. The header of the document is controlled by an SQL database.
Once the header of the document is displayed I need to be able to insert the
form (which is the word document) right below the header. I did think of
using frames and just use a "link" which would populate the bottom frame
with the document, but I was hoping that I would be able to insert the
document in the web page where it looks as if it is just one web
page....header and the form. I hope that makes sense.

For a test I downloaded the following code which is suppose to display a
document in the web page. It is as follows, but I get the same error:

<HTML>
<HEAD>
<TITLE>Using ASP To View & Print A Word Document</TITLE>
<META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</HEAD>
<BODY bgcolor="#FFFFFF">
<FORM method="post" action="WordViewer.asp" name="frmMain">
<TABLE width="600" border="1" cellspacing="0" cellpadding="4"
align="center" bordercolor="#000000">
<TR>
<TD colspan="2" align="left" valign="top" bgcolor="#000000"><FONT
size="2" face="Verdana, Arial, Helvetica, sans-serif"
color="#FFFFFF"><B>Viewing
& Printing MS Word Documents Using ASP</B></FONT></TD>
</TR>
<TR align="left" valign="top" bgcolor="#999999">
<TD width="40%" rowspan="2"><FONT size="2" face="Verdana, Arial,
Helvetica, sans-serif">Word
Document To View Print<BR>
<INPUT type="File" name="fldFilePath">
</FONT></TD>
<TD width="60%"><FONT size="2" face="Verdana, Arial, Helvetica,
sans-serif">
<INPUT type="checkbox" name="chkPrint" value="PrintDoc">
<FONT size="1">Check To Enable Printing</FONT></FONT></TD>
</TR>
<TR align="left" valign="top">
<TD width="60%" align="left" valign="top" bgcolor="#999999"><FONT
size="2" face="Verdana, Arial, Helvetica, sans-serif"><FONT size="1">
<INPUT type="submit" name="Submit" value="Open Document">
</FONT></FONT></TD>
</TR>
</TABLE>
</FORM>
</BODY>
</HTML>
<%

'our variable
Dim strDocPath
Dim intPrintCount

'get the path To the document to
'view and the value To see if the
'user wants To print this document
strDocPath = Request.Form("fldFilePath")
bolPrintDoc = Request.Form("chkPrint")
'lets see if we have a path
'if we Do Then show the doc
if strDocPath > "" Then
'we have a path so lets show the document

'create the object
Set objWord = CreateObject("WORD.Application")
'Show The Word Application
objWord.Visible = True
'open the document
objWord.Documents.Open strDocPath
'lets see if we need To print it out
if bolPrintDoc = "PrintDoc" Then
'lets print it To the default printer
objWord.PrintOut
End if
'clear it from mem
Set objWord = Nothing
End if
%>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top