Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 02-17-2020, 10:30 AM
hlock hlock is offline How to Use XML Parts with .dotm Windows 7 64bit How to Use XML Parts with .dotm Office 2010 64bit
Novice
How to Use XML Parts with .dotm
 
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
  #2  
Old 02-17-2020, 05:44 PM
macropod's Avatar
macropod macropod is offline How to Use XML Parts with .dotm Windows 7 64bit How to Use XML Parts with .dotm Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Cross-posted at: vba - How to Use XML Parts with .dotm - Stack Overflow
For cross-posting etiquette, please read: Excelguru Help Site - A message to forum cross posters
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 02-18-2020, 04:36 PM
Guessed's Avatar
Guessed Guessed is offline How to Use XML Parts with .dotm Windows 10 How to Use XML Parts with .dotm Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,932
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

Looking at the other thread linked by Paul, you have a bunch more information there that complicates this further. I'm not a member there so I'm not posting there.

Firstly, your docm files all have an 'attached template' so you can still house building blocks in Normal.dotm, the attached template or even an addin. If the docm files already have a common attached template then that would be the simplest place to put your building blocks.

Secondly, are you trying to do all of this via code or do you want to use the Word GUI to link to the xml elements (fields)?

Thirdly, the code shown for Document_New is not achieving anything let alone doing this...
Quote:
I have tried "binding"(?) the xml part in the Sub Document_New code.
You generally bind a Content Control to an embedded XML Custom part's xml element. You might replace or update the xml custom part but I wouldn't use the terminology of binding it to the document.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
Reply

Tags
template quickparts word, word 16, xml source

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to Use XML Parts with .dotm Normal.dotm location? gogreen Word 6 07-17-2016 09:45 AM
Convert .dotm to .dotx rogelinepaula Word 1 06-04-2015 09:39 PM
.dotm available to all users? donaldadams1951 Word VBA 3 05-06-2015 07:02 PM
Location of normal.dotm namedujour Word 3 04-25-2013 03:24 PM
How to Use XML Parts with .dotm How to get to normal.dotm Aiken_Bob Word 4 05-02-2011 02:41 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 12:53 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft