I have searched high and low on stackexchange and other sites (vbaexpress, MSDN, etc...). There is extensive dialog around this, I have tried most of the examples, and still nothing is working.
Scenario:
- User clicks 'Create Report' button in Access.
- vba creates a new instance of a Word doc from the default template associated with a SharePoint library.
- The Word template is formatted with tables and bookmarks to accept data, AND already has a number of custom property fields stored (NULL at this time)
- vba pulls data from tables (tables are linked to SharePoint lists) and populates the entire Memo.
- the code then saves the new document to the SP library (same one with the template) and checks it in.
All of this works fine.
The vba also includes the code to store both built-in and the custom properties: example of the code:
Set objWord = CreateObject("Word.Application")
Set objDoc = objWord.Documents.Add(tName)
objWord.Visible = True
objDoc.BuiltinDocumentProperties("Title") = "2040"
With objDoc.CustomDocumentProperties
.Add name:="DocLevel", _
LinkToContent:=False, _
Type:=msoPropertyTypeString, _
Value:="Confidential"
.Add name:="UserDiscipline", _
LinkToContent:=False, _
Type:=msoPropertyTypeString, _
Value:="Broker"
End With
objDoc.SaveAs (fPath)
objDoc.CheckIn
Also, assuming that the properties are already objects in the template, I tried this just setting without the .Add:
objDoc.CustomDocumentProperties name:="DocLevel", LinkToContent:=False, _
Type:=msoPropertyTypeString, Value:="Confidential"
Everything works - EXCEPT - the custom doc properties are not saved. Even the built ones are saved - but not the custom ones.
I have the MS Office 14.0 Object Library, 14.0 Access library and VB for extensibility included. Is there some other reference that I need?
Thanks in advance to the Overflow community for any help...