Closed Thread
Results 1 to 4 of 4

the Parent property

  1. #1
    mrmack
    Guest

    the Parent property

    I see a lot of the objects in the Excel Object Model have this 'Parent'
    property.

    I am only interested in retreiving the host Workbook for a worksheet, which
    brought me to this article:
    http://msdn2.microsoft.com/en-us/lib...et.parent.aspx

    It worryingly states

    "IF the current Worksheet has a parent, then name of the parent workbook is
    displayed."

    So, I guess my questions is

    When would a worksheet not have a parent?

  2. #2
    Charlie
    Guest

    RE: the Parent property

    Good question. Personally I thought that example was crap, but maybe I'm
    missing something. I would think the author was trying to say "If Me.Parent
    Is Nothing Then 'Me' is not a worksheet" I suspect all worksheets have a
    parent.

    P.S. if 'Me' is the workbook, not a sheet, then Me.Parent.Name returns
    "Microsoft Excel"


    "mrmack" wrote:

    > I see a lot of the objects in the Excel Object Model have this 'Parent'
    > property.
    >
    > I am only interested in retreiving the host Workbook for a worksheet, which
    > brought me to this article:
    > http://msdn2.microsoft.com/en-us/lib...et.parent.aspx
    >
    > It worryingly states
    >
    > "IF the current Worksheet has a parent, then name of the parent workbook is
    > displayed."
    >
    > So, I guess my questions is
    >
    > When would a worksheet not have a parent?


  3. #3
    NickHK
    Guest

    Re: the Parent property

    Under "normal" XL circumstances, .Parent returns the expected object.
    However, (untested and only suspicion, test if you want) when you examine
    this property in situations of:
    - embedded in another OLE file
    - shown in a webrowser
    - shown in an OLE control
    you may get different answers.

    I can see that a WS.Parent may not be WB, but I fail to see how it could
    Nothing.
    How would you create/reference a WS that had no parent.

    That code is saying that WS.Parent is either a WB or nothing.

    NickHK

    "mrmack" <[email protected]> wrote in message
    news:[email protected]...
    > I see a lot of the objects in the Excel Object Model have this 'Parent'
    > property.
    >
    > I am only interested in retreiving the host Workbook for a worksheet,

    which
    > brought me to this article:
    >

    http://msdn2.microsoft.com/en-us/lib...et.parent.aspx
    >
    > It worryingly states
    >
    > "IF the current Worksheet has a parent, then name of the parent workbook

    is
    > displayed."
    >
    > So, I guess my questions is
    >
    > When would a worksheet not have a parent?




  4. #4
    NickHK
    Guest

    Re: the Parent property

    I should add:

    > That code is saying that WS.Parent is either a WB or nothing.

    which seems misleading if the rest of my post correct.

    NickHK

    "NickHK" <[email protected]> wrote in message
    news:[email protected]...
    > Under "normal" XL circumstances, .Parent returns the expected object.
    > However, (untested and only suspicion, test if you want) when you examine
    > this property in situations of:
    > - embedded in another OLE file
    > - shown in a webrowser
    > - shown in an OLE control
    > you may get different answers.
    >
    > I can see that a WS.Parent may not be WB, but I fail to see how it could
    > Nothing.
    > How would you create/reference a WS that had no parent.
    >
    > That code is saying that WS.Parent is either a WB or nothing.
    >
    > NickHK
    >
    > "mrmack" <[email protected]> wrote in message
    > news:[email protected]...
    > > I see a lot of the objects in the Excel Object Model have this 'Parent'
    > > property.
    > >
    > > I am only interested in retreiving the host Workbook for a worksheet,

    > which
    > > brought me to this article:
    > >

    >

    http://msdn2.microsoft.com/en-us/lib...et.parent.aspx
    > >
    > > It worryingly states
    > >
    > > "IF the current Worksheet has a parent, then name of the parent workbook

    > is
    > > displayed."
    > >
    > > So, I guess my questions is
    > >
    > > When would a worksheet not have a parent?

    >
    >




Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1