Visio 2007: Probably not a bug, but it is confusing me none the less....
Steps:
Create an embeded excel sheet using Insert/Object Mcrosoft Office Excel Binary Worksheet and check the "display as Icon" checkbox (Also, the behavior manifests with Macro-Enabled Worksheet. I have not tried others.) For sake of example say that this object has the name of Sheet.1
Create a box with the Box tool
Group the Box and the spreadsheet object.
I would like to assign the double-click behaviour of this group to be opening up the spreadsheet for editing. So in Format/Behavior I assign a macro in the double-click tab:
This works.....
Sub EditSheet()
Dim shpTheShape As Visio.Shape
Set shpTheShape = ActivePage.Shapes("Sheet.1")
ActiveWindow.Select shpTheShape, visSubSelect
On Error Resume Next
Application.DoCmd visCmdEditOpenObject
Application.DoCmd visCmdEditOpenObject
End Sub
But why does this only work if my spreadsheet subshape is already selected when I double-click the group?
Sub EditVolumeSheet()
Dim shpTheShape As Visio.Shape
Set shpTheShape = ActivePage.Shapes("Sheet.1")
ActiveWindow.Select shpTheShape, visSubSelect
Application.DoCmd visCmdEditOpenObject
End Sub
--
Guy
OK. More wierdness, but probably explainable.....
Insert/Object Excel Spreadsheet display as an Icon
Set double-click to OLE Verb "Edit"
First double-click on the icon throws, "An error (1415) occured during the action Open Object. Visio unable to edit the Binary Worksheet object.
But the next double-click on the icon works.
And the next double-click fails with the same error as above.
The next double-click works
etc.
Is that how it is supposed to go?
--
Guy