set wApp=CreateObject("word.Application") 'OK
if err.number>0 then
response.write err.description&err.number
response.end
end
wApp.Documents.open "d:\doc\template.doc" '提示缺少对象
有人知道这个是什么问题吗?
...全文
29913打赏收藏
Documents.open 提示缺少对象?
利用vbs在服务器上操作一个doc文档 set wApp=CreateObject("word.Application") 'OK if err.number>0 then response.write err.description&err.number response.end end wApp.Documents.open "d:\doc\template.doc" '提示缺少对象 有人知道这个是什么问题吗?
不知道方法一的和我写的有什么区别?我是为了后面对doc的书签进行替换,用方法二的话就不知道怎么定位文档里面的书签了.
[Quote=引用 2 楼 mailbao 的回复:]
參考方法一
-------------
Public Sub OpenFile(FilePath as String)
Dim oWord As Object
Dim oDoc As Object
Set oWord = CreateObject("Word.Application")
oWord.Visible = True
Set oDoc = oWord.Documents.Open(FilePath)
End Sub
<%
set wApp=CreateObject("word.Application") 'OK
if err.number>0 then
response.write err.description&err.number
response.end
end if '少了个if吧
wApp.Documents.open "d:\doc\template.doc"
%>
參考方法一
-------------
Public Sub OpenFile(FilePath as String)
Dim oWord As Object
Dim oDoc As Object
Set oWord = CreateObject("Word.Application")
oWord.Visible = True
Set oDoc = oWord.Documents.Open(FilePath)
End Sub