VBA Double-Click in Visio

grashopper
05-23-2001, 08:20 AM
I'm doing some initial prep for a program I'm suppose to write and I've run into a snag. Right now all I'm doing is on the event triggered by adding a page I'm drawing a rectangle on that page and I want that rectangle to run a macro when you double-click it. The problem is that I can't figure out how to set the double-click event to run a macro from the VBA side. So unless I want the user to have to go tie to the macro on each page they add by changing the behavior dialog box double-click tab, I'm stuck. Anybody familiar with this? Can I tie into their dialog box through the code and make the change that way? Any help would be great.

grashopper
05-24-2001, 09:47 AM
Got it figured out finally yesterday, thought I'd share in the rare case that someone has the same problem. I had to reference the ShapeSheet in code like this:

'//Set Double-Click Event
Set objCell = objRectangle.CellsSRC(1, 5, 2) objCell.Formula = "=RUNADDON(""OpenPageProperties"")"

OpenPageProperties is a subroutine I made
The numbers (1,5,2) are for section, row, and column
I wasn't able to find anywhere that these coordinates were actually documented however so I got desparate and wrote a temporary section into my code like this:

Dim fso
Dim tso

Set fso = CreateObject("Scripting.FileSystemObject")
Set tso = fso.CreateTextFile("C:\WINDOWS\Desktop\Test.txt", True, False)

Dim i As Integer
Dim j As Integer
Dim k As Integer
For i = 0 To 254
For j = 0 To 5
For k = 0 To 15
'// objCell already had been initalized
'// objRectangle had already been set to ActivePage.DrawRectangle(1, 10, 7.5, 10.5)
Set objCell = objRectangle.CellsSRC(i, j, k)
tso.WriteLine i & "*" & j & "*" & k
tso.WriteLine "1F " & objCell.Formula
tso.WriteLine "1N " & objCell.Name
Next
Next
Next
tso.Close

This gave me a huge text file, you could make the For numbers smaller but I wanted to make sure I got what I was looking for.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum