我不确定,但作为一种猜测听起来你正在尝试使用早期绑定。如果是这样,这可能是您的问题。
在十多年的时间里,有许多 MS 知识库文章警告过这一点。例子:
http://support.microsoft.com/kb/247579
http://support.microsoft.com/kb/245115
In other words: remove all references to any version of Word, declare all of the objects As Object
, and use CreateObject()
or GetObject()
where appropriate instead of Set Obj = New LibName.ClassName
.
These KB articles are old now, and the old rules that let you get away with compiling with a reference to Word 95 and still automate Word 2002 don't seem to apply anymore. Besides needing the oldest supported version of Office installed on your dev machine, I suspect upward compatibility was broken beginning in Office 2003.
Your best bet is late binding. The performance penalty is minimal for most programs so the biggest headache is losing IntelliSense.