Results 1 to 4 of 4
  1. #1
    3 Star Lounger
    Join Date
    Aug 2002
    Location
    Denmark
    Posts
    347
    Thanks
    0
    Thanked 0 Times in 0 Posts

    CustomDocumentProperties (XP pro, Excel 2003 UK)

    Hi,

    To verify that a workbook has a certain origin, I need to check for a CustomDocumentProperty that is always being set upon creation of the workbook.
    However, if I just try to set it like:

    string = ActiveWorkbook.CustomDucomentProperties("LookMeUp" )

    and the Prop doesn't exist, I just get an 'error 5' ("Invalid procedure call or argument") in return.

    As 'error 5' is rather generic and can occur in multiple other situations, I'm reluctant to use it here.
    Would anyone know of another better way to catch or workaround this kind of situation??

    TIA
    Bests,
    RD


    PS: Wish there were a knob on the TV to turn up the intelligence. There's a knob called "brightness," but that doesn't work

  2. #2
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: CustomDocumentProperties (XP pro, Excel 2003 UK)

    I always use a function for this. My function loops through all CustomDocumentProperties comparing their name to the one I am looking for, and returns the value and a status.

    StuartR

  3. #3
    3 Star Lounger
    Join Date
    Aug 2002
    Location
    Denmark
    Posts
    347
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: CustomDocumentProperties (XP pro, Excel 2003 UK)

    Thanks Stuart

    It sounds viable, I may actually even have done something similar before... / ;o)
    Bests,
    RD


    PS: Wish there were a knob on the TV to turn up the intelligence. There's a knob called "brightness," but that doesn't work

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

    Re: CustomDocumentProperties (XP pro, Excel 2003 UK)

    But if the error occurs on that particular line you're quite sure the property isn't there, right?
    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
  •