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?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Similar Threads
  1. bherbert
    Replies:
    0
    Views:
    576
    bherbert
    Aug 16, 2011
  2. bherbert

    Linking to excel file

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