Skip to sidebar Skip to content
Ipercube Technical
Jack of all trades, master of none
Date: Time: - Stardate:
Welcome, Log in by clicking  Here!
SS64
MDN
Stack
Code
GitHub
Wiki
Convert
V Studio
  • Home
  • VB Functions
    • Access Functions
    • Assembly Info
    • Color/Image Functions
    • Data Table Functions
    • Email Functions
    • Active Directory Functions
    • LDAP Functions
    • Excel Functions
    • Logging Functions
    • Source Code Retrieval
    • String Functions
    • Sql Functions
    • Object Utilities Functions
    • System and Utilities
    • Utility Forms
  • VB Classes
    • Environment Variables Helper
  • ABAP
    • ABAP Reports
    • ABAP HTTP Functions
Ipercube Technical
  • Home
  • VB Functions
    • Access Functions
    • Assembly Info
    • Color/Image Functions
    • Data Table Functions
    • Email Functions
    • Active Directory Functions
    • LDAP Functions
    • Excel Functions
    • Logging Functions
    • Source Code Retrieval
    • String Functions
    • Sql Functions
    • Object Utilities Functions
    • System and Utilities
    • Utility Forms
  • VB Classes
    • Environment Variables Helper
  • ABAP
    • ABAP Reports
    • ABAP HTTP Functions

Sheet Custom Property – Get Sheet Custom Properties To Datatable

Extracts all custom document properties from the specified Excel worksheet and returns them as a DataTable.

VB
    Public Function xlGetSheetCustomPropertiesToDatatable(sheet As Worksheet) As Data.DataTable

        If sheet Is Nothing Then Throw New ArgumentNullException(NameOf(sheet))

        ' Create the output DataTable
        Dim dt As New Data.DataTable()
        dt.Columns.Add("Property", GetType(String))
        dt.Columns.Add("Value", GetType(String))

        Try
            Dim props As Object = sheet.CustomProperties
            If props IsNot Nothing Then
                For i As Integer = 1 To props.Count
                    Dim prop As CustomProperty = CType(props.Item(i), CustomProperty)
                    dt.Rows.Add(prop.Name, prop.Value)
                Next
            End If
        Catch ex As Exception
            ' Optionally log the error or rethrow
            Throw New Exception("Error reading CustomProperties: " & ex.Message, ex)
        End Try

        Return dt
    End Function

Posted by ipercube


© 2026 Ipercube Design