I am attempting to use VBA to have Visio attach a data Graphic to some shapes I have on a page. I had tried this code Visio.ActiveWindow.Selection.DataGraphic = Visio.ActiveDocument.Masters("Data Graphic 2") But, that does not work.
Hi, I am new to the DataGraphics, too. Did you checked this document? http://msdn.microsoft.com/en-us/library/aa342323.aspx Did you have the DataGraphcs made by the user UI on your drawing? -- JuneTheSecond Now, visual calculation is more visual. http://www.geocities.jp/visualcalculation/english/index.html
I don't believe you can assign a Selection of objects to a DataGraphic. Rather you have to loop through the Selection and assign the DG individually. E.g, Dim visShape as Shape For Each visShape in ActiveWindow.Selection visShape.DataGraphic = ActiveDocument.Masters("Data Graphic 2") Next For Each looping is a good practice no matter what. Because almost everything is a Shape in Visio. So when you start Selecting stuff you may net objects you don't want. For Each allows you to insert a Shape check to ensure you only operate on the ones you want. SteveM On Aug 18, 9:08 pm, JuneTheSecond wrote: > Hi, > > I am new to the DataGraphics, too. > Did you checked this document?http://msdn.microsoft.com/en-us/library/aa342323.aspx > Did you have the DataGraphcs made by the user UI on your drawing? > -- > JuneTheSecond > > Now, visual calculation is more visual.http://www.geocities.jp/visualcalculation/english/index.html