I have created an extensive Network toppolgy through Visio. I have collected all network device data and complied it into a SQL database. I then have linked the Visio to the Database. So each shape shows the correct data for it. My question is, will i need to write a code to make sure it is updated. Or will it automatically update if changes are made in the database since it is linked to it?
You need a VBA Sub that starts everytime you open the drawing to refresh the Link.
If you want to refresh a Link when the drawing is open, you can do it manually or use a second similar VBA Sub to do this on command.
Where could i find directions on setting this up? would this work for the html version?
Hi Guys,
Here's an article that will help with getting code to run when a document opens: Run VBA Code When Documents Open (http://www.visguy.com/2007/05/25/run-vba-code-when-documents-open/)
Which method did you use to link shapes to the database? There are several routes in Visio. Also, which version of Visio are you using?
I am using Visio 2007 pro
A sfar as linking the data to the shapes. I have imported the databse.
I go to "Data" on the menu bar,
Link data to shapes,
Microsoft SQL Server database
then type in the sql server name and select the tables that i want.
it loads the tables
i then find the record i want and drag it to the shape i want.
all done
Than it could go like this:
Public Sub Refresh_Example()
Dim vsoDataRecordset As Visio.DataRecordset
Dim intCount As Integer
intCount = ThisDocument.DataRecordsets.Count
Set vsoDataRecordset = ThisDocument.DataRecordsets(intCount)
vsoDataRecordset.Refresh
End Sub
Taken form here:
http://msdn.microsoft.com/en-us/library/ms427208.aspx