Results 1 to 2 of 2
  1. #1
    New Lounger
    Join Date
    Aug 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Access Windows Properties

    How can one reference or link or otherwise get to Windows 7, file properties for use in office applications? For example, I would like to insert the "comments" property of a file into a spreadsheet cell by reference.
    Thanks

  2. #2
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    9,436
    Thanks
    372
    Thanked 1,457 Times in 1,326 Posts
    Wopoteat,

    Welcome to the Lounge as a new poster.
    This should do what you want.
    Code:
    Option Explicit
    
    Function zRetrieveFileComment(oFileToCheck As Object) As String
    
       With oFileToCheck
       
           On Error Resume Next   '*** In case "Version" does not exist!! ***
           zRetrieveFileComment = .BuiltinDocumentProperties.Item("Comments").Value
           On Error GoTo 0        '*** Clear Error Trap ***
       End With
       
    End Function         'zRetrieveFileComment
    
    Sub Test()
    
       Dim oFile As Object
       
       Set oFile = ActiveWorkbook
       Debug.Print oFile.Name
       Debug.Print zRetrieveFileComment(oFile)
       [A1].Value = zRetrieveFileComment(oFile)
       
    End Sub
    BuiltinDocProps.JPG
    Attached Images Attached Images
    Last edited by RetiredGeek; 2012-06-07 at 20:33.
    May the Forces of good computing be with you!

    RG

    PowerShell & VBA Rule!

    My Systems: Desktop Specs
    Laptop Specs

Tags for this Thread

Posting Permissions

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