Results 1 to 9 of 9
  1. #1
    Silver Lounger
    Join Date
    Jul 2001
    Location
    Ottawa, Ontario, Canada
    Posts
    1,609
    Thanks
    0
    Thanked 1 Time in 1 Post

    Sheet Type (VBA/Excel/2003/2003 SP2)

    My testing indicates that:
    <UL><LI>a Worksheet type = -4167
    <LI>a Chart Sheet type = 3[/list]I have been unable to find either documented confirmation of the above, nor confirmation that there are no other sheet types.

    Someone please educate me.

    T.I.A.
    Regards
    Don

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

    Re: Sheet Type (VBA/Excel/2003/2003 SP2)

    If you type type in the Visual Basic Editor and press F1, you'll get a list of objects that Type applies to. Select Worksheet. You'll see that the Type property has one of the values of xlSheetType:

    xlChart
    xlDialogSheet
    xlExcel4IntlMacroSheet
    xlExcel4MacroSheet
    xlWorksheet

    xlChart and xlWorksheet are the ones you'll encounter in 'normal' workbooks. The other three types are present only in legacy workbooks created in Excel 4 (for Windows 3.x) or earlier.

  3. #3
    Silver Lounger
    Join Date
    Jul 2001
    Location
    Ottawa, Ontario, Canada
    Posts
    1,609
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Sheet Type (VBA/Excel/2003/2003 SP2)

    Hi Hans
    Thanks for the speedy and complete response. Prior to calling for help from the Lounge, I had attempted to follow the route you suggested which is slightly different in 2003 than you described. But I didn't recognize the final link.

    I am embarrassed.
    Regards
    Don

  4. #4
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Sheet Type (VBA/Excel/2003/2003 SP2)

    Sometimes it is difficult to match up the numeric values with the descriptive constants. The Object Browser (press F2 in the VBE) can help. If you find the property, you usually can call up a list of the potential values. when you highlight the constant name, the numeric value appears in a different pane. (They really ought to make that easier...)

  5. #5
    Silver Lounger
    Join Date
    Jul 2001
    Location
    Ottawa, Ontario, Canada
    Posts
    1,609
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Sheet Type (VBA/Excel/2003/2003 SP2)

    <hr>(They really ought to make that easier...) <hr>
    Thanks Jefferson, and amen to that.
    Regards
    Don

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

    Re: Sheet Type (VBA/Excel/2003/2003 SP2)

    There is also the TypeName function:

    Typename(Activesheet)

    Gives:

    "Worksheet" for a worksheet
    "Chart" for a chart sheet
    "DialogSheet" for a dialog sheet

    But for an Excel 4 macro sheet it (illogically) returns "Worksheet". If you don;t have those, you should be fine.
    Jan Karel Pieterse
    Microsoft Excel MVP, WMVP
    www.jkp-ads.com
    Professional Office Developers Association

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

    Re: Sheet Type (VBA/Excel/2003/2003 SP2)

    > slightly different in 2003

    I used Excel 2002 when I wrote the description, but it works exactly the same for me in Excel 2003 - see image below.

  8. #8
    Silver Lounger
    Join Date
    Jul 2001
    Location
    Ottawa, Ontario, Canada
    Posts
    1,609
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Sheet Type (VBA/Excel/2003/2003 SP2)

    Thanks Hans
    The difference was in my interpretation of your post, and what you intended. Mia culpa,
    Regards
    Don

  9. #9
    Silver Lounger
    Join Date
    Jul 2001
    Location
    Ottawa, Ontario, Canada
    Posts
    1,609
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Sheet Type (VBA/Excel/2003/2003 SP2)

    Thanks Jan Karel
    Regards
    Don

Posting Permissions

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