Micron,
I cheated:
Code:
Option Compare Database
Option Explicit
Dim strFile As String, strFolder As String, tableName As String, FileNameClip As String
Code:
Private Sub Open_Visio_Click()
Dim VisioApp As Object
Dim FName As String
On Error Resume Next
FName = "C:\Users\Wayne\Desktop\HB_Baseline.vsdm"
Set VisioApp = GetObject(, "Visio.Application")
If VisioApp Is Nothing Then
Set VisioApp = CreateObject("Visio.Application")
If VisioApp Is Nothing Then
Exit Sub
End If
End If
On Error GoTo 0
VisioApp.Documents.Open FName
VisioApp.Visible = True
End Sub
I know I need to fix the "C:\Users\Wayne\Desktop\HB_Baseline.vsdm" but that's short term. I could not get Visio to open a new macro enabled VISO file named after FileNameClip. With the FName way I could get a new Visio to open and have the Developer and Data tab available.
Since there will be VBA in the Visio, it might be best to do a direct select and have Visio import the table through VBA. I have a thread open on the MSDN VISIO forum asking just that. I could use strfile
:
Code:
If F.Show Then
For Each VarItem In F.SelectedItems
strFile = Dir(VarItem)
strFolder = Left(VarItem, Len(VarItem) - Len(strFile))
Next
End If
to set the directory.
I'm not all too sure about how to reference the string variables in another sub. I tried
VisioApp.Documents.add Update_Table2.FileNameClip and it had issues with the Update_Table2