Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    Nov 2002
    Posts
    387
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Detecting is object is an embedded Excel Worksheet (Excel 2000)

    We have a COM addin that handles both Excel and Word events such as New and Open. On a Word document that has an embedded Excel Worksheet, when the Worksheet is selected the Excel Open event is fired and it looks for a menu command bar which there isn't and an error is generated. Is there a way to detect that the object is an Embedded Excel Worksheet so as to condition around the menu creation code or is there a way to detect that no menu exists?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Detecting is object is an embedded Excel Worksheet (Excel 2000)

    I have no experience with COM add-ins, but try Application.UserControl. It is True if Excel was started by the user, False if it was started by Automation - it will probably return False in an embedded worksheet too.

  3. #3
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Weert, Limburg, Netherlands
    Posts
    4,812
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Detecting is object is an embedded Excel Worksheet (Excel 2000)

    I use these two lines to detect whether a workbook is being edited in place or is embedded:

    ' In embedded mode
    InStr(Application.CommandBars.FindControl(ID:=106) .Caption, "&&") > 0
    ' Editing in place
    oLocalWorkbook.IsInplace
    Jan Karel Pieterse
    Microsoft Excel MVP, WMVP
    www.jkp-ads.com
    Professional Office Developers Association

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •