简体   繁体   中英

How to obtain the properties of an Excel file in SharePoint using VBA?

i am creating a macro file with command buttons that when you click it, it will display the properties esp the last modified date and time of an Excel file uploaded in a SharePoint site. How can i do this using VBA. You're prompt response is very appreciated. Thanks a lot!

I believe the only way to get the vba/macro to run is to 'Open in Excel' from SharePoint 2010. I don't think vba/macros will run when you open an Excel file in the browser.

I added the following code to VBA (press alt F11 to get the VBA editor open):

 Public Sub documentProperties()
      On Error Resume Next
      Dim oApp As New Excel.Application
      Dim oWB As Workbook
      Set oWB = ActiveWorkbook

      Dim propertieslist As String
      For l = 1 To oWB.BuiltinDocumentProperties.Count
        MsgBox oWB.BuiltinDocumentProperties.Item(l).Name & ":" & oWB.BuiltinDocumentProperties.Item(l).Value
      Next l

      MsgBox propertieslist
    End Sub

I then put a button on the excel sheet (Google search for "excel 2010 add button") to get instructions for adding the developer menu to the ribbon.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM