VBA to open an embedded Excel Object

Joined
May 6, 2014
Messages
1
Reaction score
0
I have created a group where one of the shapes in the group is an embedded Excel workbook (Sheet.5 in my example below).

I would like the double-click behavior of the group to be opening up the spreadsheet for editing.

I have assigned a macro to the group double-click via the Format/Behaviour dialog.

My question is why does this always work:
----------
Code:
Sub EditVolumeSheet()
    Dim shpTheShape As Visio.Shape
    Set shpTheShape = ActivePage.Shapes("Sheet.5")
    ActiveWindow.Select shpTheShape, visSubSelect
    On Error Resume Next
    Application.DoCmd visCmdEditOpenObject
    Application.DoCmd visCmdEditOpenObject
End Sub
--------

But this only works if the group or a sub-shape in the group was selected just before I double-click:
--------------
Code:
Sub EditVolumeSheet()
    Dim shpTheShape As Visio.Shape
    Set shpTheShape = ActivePage.Shapes("Sheet.5")
    ActiveWindow.Select shpTheShape, visSubSelect
    Application.DoCmd visCmdEditOpenObject
End Sub
-----------------
 

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