简体   繁体   English

从VBA打开Word文档

[英]Opening word doc from VBA

I have a subroutine in MS Access that opens a specific word doc file. 我在MS Access中有一个打开特定Word文档文件的子程序。 The gist of the code is 代码的要点是

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. 我们都在同一个Citrix环境中,并且我们都有相同版本的Access和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. 对于此用户,该子例程不会给出错误-它可以打开ms word的空白实例,但从不打开word doc文件。 What gives? 是什么赋予了?

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! 谢谢大家的帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM