Error accessing XML Node

C

confuseddotcom

Hi,

I'm using XML nodes in Word 2007 and have successfully creating documetns
and updated node values. However on occasion I get an error message stating:

"This predefined bookmark is available for the active document only."

The strange thing is that this only happens intermittently but it is always
when I try to access the node. eg. of code:
Dim DataNodes As Word.XMLNodes
DataNodes = ActiveDocument.SelectNodes("//*", PrefixMapping, True)
For Each n As Word.XMLNode In DataNodes
If n.BaseName Like "FreeText*" Then
n.Range.Editors.Add(Word.WdEditorType.wdEditorEveryone)
End If
Next

This code will error when n.BaseName is called. Again this happens on
occasion so I can't really narrow down why it's happening.
Can anyone help?

Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top