Office中国论坛/Access中国论坛
标题:
在Access中操作word文档的问题
[打印本页]
作者:
ronaldxiexiea
时间:
2006-7-5 21:42
标题:
在Access中操作word文档的问题
请看这段代码,从Access中调用word并进行操作,为什么不行? 如果截止到with bdoc上方,运行都是可以的,也就是说可以打开,但是让他进行操作的时候,就不对了,下面的是对word的最基本vba,在word中直接运行可以,但是从access中调用word,然后再运行就不行了,大虾请指点一下,word的运行库已经引用了
Dim a as Object
Dim bdoc as Document
Set a = New Word.Application
a.Visible = True
Set bdoc = a.Documents.Open("D:\ronald\office\Templates\Legacy\List.doc")
With bdoc
Selection.MoveDown Unit:=wdLine, Count:=6
Selection.EndKey Unit:=wdLine, Extend:=wdExtend
Selection.TypeBackspace
End With
作者:
cqw
时间:
2006-7-5 22:22
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
'
'注意事项:单击在菜单"工具"中的"引用"菜单项,弹出窗口,在列表框中选择"Microsoft Word X Object Libaray",单击引用
'
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
作者:
tmtony
时间:
2017-9-11 10:46
除了引用对角,还要将 wdExtend EndKey wdLine等常量 内容直接改成数字较好
欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/)
Powered by Discuz! X3.3