从 VBA 打开 word 文档
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15667360/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Opening word doc from VBA
提问by Ben G
I have a subroutine in MS Access that opens a specific word doc file. The gist of the code is
我在 MS Access 中有一个子程序,可以打开一个特定的 word doc 文件。代码的要点是
Dim wrdApp As Word.Application
Dim wrdDoc As Word.Document
Dim filepath as String
'Open Word
Set wrdApp = CreateObject("Word.Application")
wrdApp.Visible = True
filepath = CurrentProject.Path & "\Prospect Profiles\Account Profile Form.doc"
'Open the file
Set wrdDoc = wrdApp.Documents.Open(filepath)
So here's the kicker - The subroutine works for all but one of our employees. We're all on the same Citrix environment, and we all have the same version of Access and Word. For this user, the subroutine does not give an error - it smiply opens a blank instance of ms word but it never opens the word doc file. What gives?
所以这里是踢球者 - 除了我们的一名员工之外,该子程序适用于所有员工。我们都在同一个 Citrix 环境中,而且我们都有相同版本的 Access 和 Word。对于这个用户,子例程不会给出错误 - 它只是简单地打开 ms word 的空白实例,但它从不打开 word doc 文件。是什么赋予了?
回答by Ben G
Aha! It turns out that this user had made a copy of an older version of our database front end and he wasn't accessing our current, updated version. Thanks for all the help y'all!
啊哈!事实证明,该用户复制了我们数据库前端的旧版本,而他没有访问我们当前的更新版本。感谢大家的帮助!