开发者

Error creating Word object in classic ASP on IIS7

开发者 https://www.devze.com 2023-04-10 23:05 出处:网络
In the middle of converting our Intranet from a Windows 2000/IIS 4 box to a Windows 2008/IIS 7 box.Just doing a straight conversion for now, with an eye on redeveloping some apps in C#.NET in the futu

In the middle of converting our Intranet from a Windows 2000/IIS 4 box to a Windows 2008/IIS 7 box. Just doing a straight conversion for now, with an eye on redeveloping some apps in C#.NET in the future.

New server has Word 2010 installed, old has Word 2003.

Running into an issue with a classic ASP app. Attempting to create and modify a Word document based on a template document.

Receiving following error:

Microsoft VBScript runtime error '800a01a8' 

Object required: 'Documents.Open(...)'

The code it is attempting to run is as follows:

Dim wrdObj
Set wrdObj = Server.CreateObject("Word.application")
Dim wrdDoc
Set wrdDoc = Server.CreateObject("Word.Document")
Set wrdDoc = wrdObj.Documents.Open(docRoot & docName)
' Do word assignments
With wrdDoc
    .Variables("Today").Value = rs.Fields.Item("TODAY").Value & " "
    .Variables("Requester").Value = Request.QueryString("strUser")开发者_如何学编程 & " "
    .Variables("Ship_Comp").Value = rs.Fields.Item("TXT_VENDOR_NAME").Value & " "
    .Variables("Ship_Addr").Value = rs.Fields.Item("ADDR").Value & " "
    .Variables("Ship_City").Value = rs.Fields.Item("CITY").Value & " " & rs.Fields.Item("STATE_ZIP").Value
    .Variables("Ship_Country").Value = rs.Fields.Item("COUNTRY").Value & " "
    .Fields.Update
    .Save
End With
'wrdDoc.Section
wrdDoc.Close
Set wrdDoc = Nothing
wrdObj.Quit
Set wrdObj = Nothing

It is failing on the following line:

Set wrdDoc = wrdObj.Documents.Open(docRoot & docName)

I've done a bunch of searches out there, but not many people appear to be using Word 2010 automation in classic ASP for some strange reason... :)


I was running into something similar on the 64-bit version of Windows Server 2008 and attempting some Excel automation. Apparently the 64-bit version has some Office automation issues. I'm not sure if they extend to all of Office Automation, or if it's just Excel, but here is the link that I used to fix my problem.

http://social.msdn.microsoft.com/Forums/en-US/innovateonoffice/thread/b81a3c4e-62db-488b-af06-44421818ef91?prof=required

I created the folders mentioned in the 2nd post, and it worked like a charm.

0

精彩评论

暂无评论...
验证码 换一张
取 消