在word2003下使用没有问题,操作2007就出问题了!
Dim WordApp As Word.Application
Dim WordDoc As Word.Document Set WordApp = CreateObject("Word.Application")
Set WordDoc = WordApp.Documents.Open(App.Path & "\DOC\模版.doc")
With WordApp
.Visible = False
' .Activate
End With
With WordApp
.Visible = False
' .Activate
.........
With WordDoc
End With
WordDoc.SaveAs ("c:\doc.doc")
WordDoc.Close
WordApp.Quit
Set WordDoc = Nothing
Set WordApp = Nothing
Dim WordApp As Word.Application
Dim WordDoc As Word.Document Set WordApp = CreateObject("Word.Application")
Set WordDoc = WordApp.Documents.Open(App.Path & "\DOC\模版.doc")
With WordApp
.Visible = False
' .Activate
End With
With WordApp
.Visible = False
' .Activate
.........
With WordDoc
End With
WordDoc.SaveAs ("c:\doc.doc")
WordDoc.Close
WordApp.Quit
Set WordDoc = Nothing
Set WordApp = Nothing
有没有把引用word2003改成word2007?
如果改的话,应该不会出什么问题的为了避免这样的情况
最好是用createobject来创建对象
这样就不会因为版本不一样而发生错误
并且也不用引用对象
打包的程序也小很多~~~~~
关键是有时候用的机器是2003,有的机器是2007;
我用的是createobject啊?
如何用createobject来创建对象?