View Single Post
 
Old 02-17-2020, 10:30 AM
hlock hlock is offline Windows 7 64bit Office 2010 64bit
Novice
 
Join Date: Dec 2012
Posts: 6
hlock is on a distinguished road
Default How to Use XML Parts with .dotm

We use documents (.docm) that when opened pulls in information from our claim system. Using an XML part (http://schemas/company.net/ContentManagement.Claims), we are able to map information from our claims to the document using content controls. This would include information such as policy, claim, date of loss, policy, insured, etc. We use
Code:
Set objNode = ActiveDocument.CustomXMLParts.SelectByNamespace("http://schemas.company.net/ContentManagement.Claims").Item(1).DocumentElement
to "bind"(?) the xml part to the document. This was setup by a consultant several years ago and it works very well. I make changes to the document based on our needs as well as make changes to the vba that controls some of the user forms that pop up when the document opens. Here is the crux of the problem at hand. All of these documents are .docm and use the Sub Document_Open code. Because they are not .dotm templates, I am not able to use quick parts or building blocks. We would like to expand our ability to use these documents by including commonly used coverage wording (paragraphs with specific formatting).

I have tried "binding"(?) the xml part in the Sub Document_New code.

Code:
Private Sub Document_New()

Dim objNode As CustomXMLNode

Set objNode = ActiveDocument.CustomXMLParts.SelectByNamespace("http://schemas.rlicorp.net/ContentManagement.Claims").Item(1).DocumentElement
    
End Sub
However, the claim data doesn't populate the content controls. It's like it disconnects from the claim information when the new document opens. I apologize if my terminology isn't correct. I've been trying to teach myself all of this and I do not have access to Visual Studio. Any suggestions on being able to pull the claim information with the xml part and to use building blocks would be most appreciated.
Reply With Quote