我正在使用 Access 2013 并在表单上创建了一个帮助按钮,我想打开一个带有说明的 Word 文档。这是我试过的代码:
Private Sub cmdHelp_Click()
Dim wrdApp As Word.Application
Dim wrdDoc As Word.Document
Dim filepath As String
Set wrdApp = CreateObject("Word.Application")
wrdApp.Visible = True
filepath = "C:\...\Handout.docx"
Set wrdDoc = wrdApp.Documents.Open(filepath)
End Sub
问题是,当我尝试编译时,第一行出现“未定义用户定义类型”的错误
最佳答案
请检查您是否在 VBA 环境中设置了对 Word 库的适当引用。
要这样做,请遵循以下路径:
Go to VBA Editor >> Menu >> Tools >> References >>
Find on the list Microsoft Word XX.X Object Library where
XX.X is the highest available number >>
Check it >> press OK.
关于ms-access - 在 Access 2013 中使用 VBA 打开 Word 文档,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17973041/