+ Reply to Thread
Results 1 to 9 of 9

Test if Workbook property exists

  1. #1
    Forum Contributor
    Join Date
    08-23-2010
    Location
    Staten Island, NY
    MS-Off Ver
    Excel 2003
    Posts
    242

    Test if Workbook property exists

    I use custom workbook properties to save "settings" for each workbook. Is there a way to test if that property exists?

    Here is one Property that I add:

    Please Login or Register  to view this content.
    How can I test if that property exists?

    And also is there a way to test if Any Custom Properties exist, instead of specific ones?

  2. #2
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: Test if Workbook property exists

    See if Chip's routines help. http://www.cpearson.com/excel/docprop.aspx

  3. #3
    Forum Contributor
    Join Date
    08-23-2010
    Location
    Staten Island, NY
    MS-Off Ver
    Excel 2003
    Posts
    242

    Re: Test if Workbook property exists

    Ken,

    Thank you for the help but I do not see anywhere in his routines, how to test if the property exists or not. I can only see how to set the property and how to test the value.

  4. #4
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: Test if Workbook property exists

    Did you download dsofile.dll and try his ReadPropertyFromClosedFile?

  5. #5
    Forum Contributor
    Join Date
    08-23-2010
    Location
    Staten Island, NY
    MS-Off Ver
    Excel 2003
    Posts
    242

    Re: Test if Workbook property exists

    I am not testing a property in a closed file. I am just testing if it exists in an open workbook.

  6. #6
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: Test if Workbook property exists

    In that case, simply:
    Please Login or Register  to view this content.
    The advantage to closed file processing is that it is faster. The file can be open for some routines as is this case. If you use Chip's routines, you will need to delete some "DSOFile." prefix parts. When you Compile, you can see which ones.

    e.g.
    Please Login or Register  to view this content.
    Last edited by Kenneth Hobson; 03-19-2012 at 04:09 PM.

  7. #7
    Forum Contributor
    Join Date
    08-23-2010
    Location
    Staten Island, NY
    MS-Off Ver
    Excel 2003
    Posts
    242

    Re: Test if Workbook property exists

    the problem is his routines say they do not work with Excel 2007 and later - which my company uses.

  8. #8
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: Test if Workbook property exists

    Just what routine is a problem? I don't know what Chip means by:
    NOTE: The DSO OLE Document Property Reader does NOT parse properties out of Office 2007 and later files, since these are not OLE files.
    The examples that I gave were for Excel 2010 that worked for me.

    So, do my two solutions work for you?
    Last edited by Kenneth Hobson; 03-20-2012 at 03:58 PM.

  9. #9
    Forum Contributor
    Join Date
    08-23-2010
    Location
    Staten Island, NY
    MS-Off Ver
    Excel 2003
    Posts
    242

    Re: Test if Workbook property exists

    Thank you Ken,

    I have not had the chance to respond but your code for an open workbook did work perfectly. I never tested to see if the code worked on 2007 files but if you say it does I will test it out because that could help me in another issue.

+ Reply to 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