[VI-2010] VBA Visio - Execute add-ons in macros.

Started by Ashallar, October 08, 2012, 11:22:19 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Ashallar

Hi guys,

i'd liked to know if it was possible to execute add-ons visio in my macros ?
And how to write the command ?

For exemple, if i want to execute the add-ons DBR (Refresh the shape properties), how to do that in vba ?

Thanks for reading, hope my english is not too bad,

A french studient.

aledlund

something like this ?


If shp.CellExists("User.ODBCConnection", Visio.visExistsAnywhere) <> 0
Then
'Loop thru to check if shape has refresh action
If shp.SectionExists(Visio.visSectionAction,
Visio.visExistsAnywhere) <> 0 Then
For iRow = 0 To shp.RowCount(Visio.visSectionAction) - 1
If shp.CellsSRC(Visio.visSectionAction, iRow,
Visio.visActionAction).Formula = "RUNADDON(""DBS"")" Then
'Force the cell formula to run
shp.CellsSRC(Visio.visSectionAction, iRow,
Visio.visActionAction).Trigger
Exit For
End If
Next iRow
End If
End If





al

Ashallar

Hi aledlund, first of all, thanks for answering so fast ! :)

Outch, seems a little bit complicate for me !

In fact, i just want to select all the shapes of my page, and execute the Runaddon("DBS") on all of the ones connected with a database.

Just to get a refresh of all my shapes on the page by one mouseclick.

What you wrote seems like doing what i want, without the SelectAll, but i'm not sure to understand all the code, principally all the xx.xxxx.xxx

do you have any link for me to understand this more please ?

Thanks anyway for the help and the time you took to respond, i appreciate.

aledlund

This should help
http://msdn.microsoft.com/en-us/library/aa245244(v=office.10).aspx
The "xx.xxxx.xxx" stuff is optional and pretty much a matter of taste. Some developers use the 'enumerations' some go with the static values. (0 vs. visAnywhere).
The short answer to your original question would have been, "yes you can call an addon programmatically". A short cut for learning this is to use the macro recorder to capture a database refresh and see what Visio is calling when you press the keys.
al