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

查看:80
本文介绍了在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:\Path\FileName.vsd"

VisioApp.documents.Open FName '
 VisioApp.Visible = True

您可能需要进入VB编辑器,单击工具> 参考,然后将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天全站免登陆