How to "Refresh Shape Properties" in VB Program.

J

jundol

Once a shape was linked with database, you can syncronize the shape
properties with database by click right button and selecting "Refresh Shape
Properties".

How can I do the same thing in VB Program.
 
A

Al Edlund

You might try something like this since it is an addon process.
al


Public Sub DoRefresh()
Dim myPage As Visio.Page
Dim myDoc As Visio.Document

myDoc = Visio.Application.ActiveDocument

For Each myPage In myDoc.Pages
RUNADDON ("DBRS")
' MsgBox CStr(myPage.Name)
Next myPage

End Sub
 
J

jundol

Thank you for your suggestion but I'd like to update shape properties on a
selected shape NOT by pages.
 
D

David Parker

If you have used the database wizard to add the DBR menu item then:

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
 
J

jundol

Hi David:

Thank you very much. It works well.
But I got a confirming window to "Select Database Record".
So I need to click "Yes" button.
Can I avoid this window to come up in any ways?

Shawn Lee
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top