2

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?

JFewtrell
  • 25
  • 6

1 Answers1

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.

LiamH
  • 1,492
  • 3
  • 20
  • 34