VB创建word多次,初始化页边距提示服务器不存在或不能使用

一个按钮代码(VB里先引用word):
Private Sub Command1_Click()
Dim newDoc As Word.Document
Set newDoc = New Word.Document
'以下五行代码设置缺省格式
newDoc.Select
With newDoc.PageSetup
.TopMargin = CentimetersToPoints(2.1)
.BottomMargin = CentimetersToPoints(0.5)
.LeftMargin = CentimetersToPoints(1.9)
.RightMargin = CentimetersToPoints(1.9)
End With
newDoc.SaveAs App.Path & "\aa.doc"
newDoc.Close
Set newDoc = Nothing
MsgBox "OK"
End Sub
按第两次就出现 服务器不存在或不能使用 的错误在.TopMargin = CentimetersToPoints(2.1) 跪求原因!!

第1个回答  2011-03-18
CentimetersToPoints(2.1) 第2次的时候没有默认的 WORD给你了 你在前面加wrd. 就行了本回答被提问者采纳