Hello everybody.
I have 2 files - visio and excel that are linked.
But if i change the location of the files i need to lync the data again.
Is it possible visio to remember that external data is in the same folder as the work file?
( like in VBA: (ThisDocument.Path & "\the_file.xlsx") )
Thanks,
Andrei
You can try to replace the path in "Date source" in DataConnection.ConnectionString during the opening of the document via VBA.
---
Something like this
Sub ttt()
Dim doc As Visio.Document
Set doc = ActiveDocument
s = doc.DataRecordsets(1).DataConnection.ConnectionString
Pos1 = InStr(1, s, "Data Source=") + Len("Data Source=")
Pos2 = InStr(Pos1, s, "the_file.xlsx")
s1 = Mid(s, 1, Pos1 - 1)
s2 = doc.Path
s3 = Mid(s, Pos2, Len(s))
s0 = s1 & s2 & s3
Debug.Print s0
doc.DataRecordsets(1).DataConnection.ConnectionString = s0
End Sub
Thanks !
this works totally nice.
Can this be accomplished in a Visio Doc that is linked to multiple tabs within a single Excel workbook?
SubPlanner