• CustomDocumentProperties (XP pro, Excel 2003 UK)

    Home » Forums » AskWoody support » Productivity software by function » Visual Basic for Applications » CustomDocumentProperties (XP pro, Excel 2003 UK)

    Author
    Topic
    #455793

    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

    Viewing 1 reply thread
    Author
    Replies
    • #1136002

      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

      • #1136004

        Thanks Stuart

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

    • #1136186

      But if the error occurs on that particular line you’re quite sure the property isn’t there, right?

    Viewing 1 reply thread
    Reply To: CustomDocumentProperties (XP pro, Excel 2003 UK)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: