Forum Discussion
SeanG1246
Jan 31, 2022Copper Contributor
Excel VBA Macro to display SharePoint Content Type Columns
Hi there, I am trying to use an Excel VBA macro to gather data from my SharePoint content type columns and display it in an excel spreadsheet.
When using the CompanyID function it returns the correct result. However, when I try to return the Title of the file it just returns 0. Is there anything I need to add or change within my code to fix this issue?
Function Title()
Dim wb As Workbook
Set wb = ThisWorkbook
For Each prop In wb.ContentTypeProperties
If prop.Name = "Title" Then
Title = prop.Value
End If
Next prop
End FunctionFunction CompanyID()
Dim wb As Workbook
Set wb = ThisWorkbook
For Each prop In wb.ContentTypeProperties
If prop.Name = "CompanyID" Then
CompanyID = prop.Value
End If
Next prop
End Function
Here is the 2 cells that are populated. I have used =Title() to call the title function and =CompanyID() to call the CompanyID Function.
The expected outcome of the Name cell should be Testing instead of 0.
No RepliesBe the first to reply