问题描述
我的数据库中的表单上有一个按钮,我想在点击时打开用户指南.我整理的用户指南在 visio 中,但我似乎找不到使用宏生成器打开它的方法.这是我需要使用 VBA 做的事情吗?如果是这样,对代码的外观有何建议?
I have a button on a form in my database that i would like to open a user guide on click. The user guide I have put to gether is in visio but i can't seem to find a way to open it using the macro builder. Is this something i would need to do using VBA? If so any suggestions on how the code should look?
推荐答案
我认为像下面这样的东西可能会起作用,不过我已经对其进行了操作以适应 visio,所以希望它能起作用.
I think something like the following may work, I have manipulated this to fit visio though, so hopefully it works.
Dim FName As String
Dim VisioApp As Object
On Error Resume Next
Set VisioApp = GetObject(, "Visio.Application")
If VisioApp Is Nothing Then
Set VisioApp = CreateObject("Visio.Application")
If VisioApp Is Nothing Then
MsgBox "Can't connect to Visio"
Exit Sub
End If
End If
On Error GoTo 0
FName = "C:PathFileName.vsd"
VisioApp.documents.Open FName '
VisioApp.Visible = True
您可能需要进入 VB 编辑器,单击 Tools
> References
,然后将 Microsoft Visio 库标记为选中.
You may need to go in to the VB editor, click Tools
> References
and then mark Microsoft Visio library as checked.
这篇关于在 Access 2010 中使用宏打开 Visio 绘图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!