Improve company productivity with a Business Account.Sign Up
' read shape ID and displayed text from XML and write to shapes in Visio
' IMPORTANT NOTE: Visio shape IDs are unique per page not per document. Consequently, this code
' assumes that the IDs read from the XML file apply to shapes on the current page.
Dim doc As Visio.Document
Dim pg As Visio.Page
Dim shp As Visio.Shape
Dim sID As String
Dim sText As String
Set doc = ActiveDocument
Set pg = ActivePage
'>>> Loop through XML document here
'For Each xmlNode In xmlDoc...
' values are set here just for example
sID = "6" ' Get Shape ID from XML node
sText = "Sample text for a shape" ' Get Displayed text from XML node
On Error Resume Next
Set shp = pg.Shapes.ItemFromID(sID)
' allow for case that shape does not exist on this page
If Not shp Is Nothing Then
shp.Text = sText
Open in new window
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
Please enter a first name
Please enter a last name
Must be at least 4 characters long.
Join and Comment
Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.
One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.