VBA to open an embedded Excel Object

Discussion in 'Visio' started by gthomas, May 6, 2014.

  1. gthomas

    gthomas

    Joined:
    May 6, 2014
    Messages:
    1
    Likes Received:
    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
    -----------------
     
    gthomas, May 6, 2014
    #1
    1. Advertisements

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. bherbert
    Replies:
    0
    Views:
    540
    bherbert
    Aug 16, 2011
  2. bherbert

    Linking to excel file

    bherbert, Aug 16, 2011, in forum: Visio
    Replies:
    0
    Views:
    808
    bherbert
    Aug 16, 2011
  3. simpilot2000
    Replies:
    1
    Views:
    657
    simpilot2000
    Sep 9, 2013
  4. Dean Letsema
    Replies:
    0
    Views:
    163
    Dean Letsema
    Feb 8, 2016
Loading...