I'm creating an Excel file (.xlsb) each day and upload it manually to SharePoint. It always puts the file under document type 'Description' in SharePoint. But I want it under Document type 'Report'.
Does someone have a piece of VBA code that sets the SharePoint Document type to 'Report' (or any other doc type) in the newly created XLSB file?
I learned how to set a document property in an XLSB but I can't find the right property that does the trick for the SharePoint doc type. If I
- change the files property in SharePoint (edit properties) and set the doc type to e.g. 'Report' (annoying)
- download that file from SharePoint
- change it, and...
- upload it to SharePoint again, ...it'll put it into the right document type section in SharePoint
But as I create a new file every day I'd like to set the SharePoint doc type directly.
Any ideas?
update 14-Nov-2019: I gave it another shot and - HEY! - it works with...
Function setDocumentType()
Dim prop As Object
For Each prop In ThisWorkbook.ContentTypeProperties
If prop.name = "Document Type" Then
prop.Value = "JoesTestDocType"
End If
Next prop
End Function
... as a first attempt. Or ...
ThisWorkbook.ContentTypeProperties.Item("Document Type") = "JoesDocType"