Open Visio Drawing using a Macro in Access 2010

大憨熊 提交于 2021-02-16 14:46:30

问题


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?


回答1:


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

You may need to go in to the VB editor, click Tools > References and then mark Microsoft Visio library as checked.



来源:https://stackoverflow.com/questions/36495483/open-visio-drawing-using-a-macro-in-access-2010

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!