在 Access 2010 中使用宏打开 Visio 绘图 [英] Open Visio Drawing using a Macro in Access 2010

查看:16
本文介绍了在 Access 2010 中使用宏打开 Visio 绘图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的数据库中的表单上有一个按钮,我想在点击时打开用户指南.我整理的用户指南在 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 绘图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆