MSDN Sample code not working

Started by Aranel, June 28, 2015, 12:04:28 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Aranel

I'm trying to understand what the code from https://msdn.microsoft.com/en-us/library/office/ff766215(v=office.14).aspx does. This code specifically:

Public Sub ApplyDataGraphic()
    Dim vsoSelection As Visio.Selection
    ActiveWindow.SelectAll
    Set vsoSelection = ActiveWindow.Selection
    Set vsoSelection.DataGraphic = ActiveDocument.Masters("MyCustomDataGraphic")
End Sub


However when I try and run it I get a compile error that says "Invalid use of property" and highlights "DataGraphic" in the second to last line.

I have shapes on my diagram, and have manually connected them to an excel spreadsheet. I created a data graphic and subsituted it's name in for "MyCustomDataGraphic".

I'm using Visio 2007, but MSDN says that Selection.DataGraphic was added in Visio 2007.

What's causing this error?

Thanks in advance!  :)

JuneTheSecond

At first, please try to delete "Set" at the front of "vsoSelection.DataGraphic = Acti...."

Best Regards,

Junichi Yoda
http://june.minibird.jp/