#1
|
|||
|
|||
xml error .docm
Hi Everyone,
I have a .docm file that we use as a template. We have this document being used by quite a few people, however it seems that just 1 user has an issue using the template. After he has added all the information to the document, after he saves it and tries to open it again we get an xml error (See screenshot) and everything in the document becomes static (i.e-check boxes etc) I wanted to know what this error relates to and how can i resolve the error? Thanks in advance |
#2
|
|||
|
|||
The user enabled vba macros in security options?
The word version is the same?
__________________
Backup your original file before doing any modification. |
#3
|
|||
|
|||
Hi Mate,
Thanks for your quick response. Yes the vba security macros has been enabled. The user is currently using Word 2013. I'm not sure which word version was used to code the docm. How do i find out which version was used to code the docm? I am considering to upgrade the user to Word 2016 but want to know if this issue will be resolved in that version? Another user is using Word 2010 and the same document, however does not have any issues. Thanks in advance |
#4
|
||||
|
||||
The error is caused by malformed XML tags in the document's XML code; it has nothing to do with macros. Since only one user is affected, you might try repairing that user's Office installation (via Windows Control Panel > Programs > Programs & Features > Microsoft Office (version) > Change > Repair).
Word MVP Doug Robbins has repaired numerous such documents. See, for example: https://answers.microsoft.com/en-us/...d-fef1aba81664
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#5
|
|||
|
|||
Hi There,
Thank you for your response. After some further investigation, i have identified that other users also have the issues relating to the document. I am attaching a copy of the template. Any help with the coding if you can identify issues is appreciated. We also use Nuance Dragon to key in the information which is a speech to text software. link for template: https://1drv.ms/f/s!AsoodcrgBMWgiRjVbIDPHpylvOEm Thanks |
#6
|
||||
|
||||
The problem is most likely related to your use of ActiveX checkboxes. That can be overcome by replacing the Yes/No ActiveX checkbox sets and & Yes/No/Refer Fact Find content control checkboxes (which don't enforce an exclusive choice) with content control dropdowns giving the same options and by replacing the single-choice ActiveX checkboxes with content control checkboxes. Naturally, that will require some coding changes, too.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#7
|
|||
|
|||
Hi Macropod,
Thank you for your quick response. After some testing, I have found that the document gets corrupted when the user puts information in the highlighted section (Refer attached pic) on page 3. Is there anything you can observe relating to that particular section that you feel may be causing the issue? Thanks |
#8
|
||||
|
||||
Where the corruption manifests in the document may or may not be related to where the problem exists in the xml code; it could actually be in the code related to the preceding ActiveX checkbox, for example. The only way of finding out for sure is by examining the underlying xml code.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#9
|
|||
|
|||
Hi Mate, what would i need to do to examine the underlying xml code?
Thanks again |
#10
|
||||
|
||||
Getting access to it is simple enough - change the file's extension to .zip then open the file as a zip archive. In there is a file named 'document.xml' and the error is located somewhere in that file. You'll need an application like Notepad++ to examine the xml structure. Beyond that, though, I really don't know enough about xml coding to give much advice, other than to say the problem is usually the result of a missing end-tag of one kind or another.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#11
|
|||
|
|||
Hi Mate,
I extracted the document.xml code and ran it through an xml checker and no errors were found. https://www.w3schools.com/xml/xml_validator.asp I also opened a damaged document and ran that code through the checker and everything came back fine. Not sure why this issue is still present. If I were to incorporate the use of content check box as you describe above, how would I go about coding it? The check boxes do not contain any events, so how would the code need to be written? Can it perform similar functions such as an active x control? Are there any resources you can point me in so I could look up how code can be written with such controls? Thanks |
#12
|
||||
|
||||
Quote:
Quote:
Quote:
Quote:
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#13
|
|||
|
|||
Hi Paul,
Thank you for your response. I've started to amend the template by removing all the the activex controls. In the event i would like to add CC Checkboxes (Yes/No), how would i code it that if one CC checkbox is selected the other is disabled and vice versa? Thanks |
#14
|
||||
|
||||
For that you'd need to employ a ContentControlOnExit in the ThisDocument module of the document or its template, coded along the lines of:
Code:
Private Sub Document_ContentControlOnExit(ByVal CCtrl As ContentControl, Cancel As Boolean) Select Case CCtrl.Title Case "MyCheck" With ActiveDocument.SelectContentControlsByTitle("MyCheck") If CCtrl.Tag = "Yes" Then .Item(2).Checked = Not CCtrl.Checked ElseIf CCtrl.Tag = "No" Then .Item(1).Checked = Not CCtrl.Checked End If End With End Select End Sub See attached.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#15
|
|||
|
|||
Hi Paul,
Thank you for the help. I still seem to be having issues as when switching between th eboxes, the selected value disappears. here is my code: Code:
Case "chkYNEstatePlanning" With ActiveDocument.SelectContentControlsByTitle("chkYNEstatePlanning") If CC.ShowingPlaceholderText Then GoTo lbl_Exit If CC.Tag = "Yes" Then .Item(2).Checked = Not CC.Checked ElseIf CC.Tag = "No" Then .Item(1).Checked = Not CC.Checked End If End With Case Else End Select lbl_Exit: Application.ScreenUpdating = True Exit Sub End Sub |
Tags |
.docm, xml issue |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Word VBA docm to dotm problem | spider85 | Word VBA | 2 | 04-17-2017 02:08 AM |
SaveAs docm file from template | ptmuldoon | Word VBA | 7 | 03-09-2015 05:38 PM |
DOCM file not saving on Microsoft Word 2010 | flutterby1 | Word | 4 | 10-08-2014 10:55 AM |
How to convert docm to dotm without opening the file | Moz | Word | 1 | 12-20-2012 04:23 PM |
Docm content dissapearing when I open the file? | shabbaranks | Word | 2 | 07-18-2012 01:13 AM |