Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
[email protected] em_serg@tut.by is offline
external usenet poster
 
Posts: 1
Default XMLNodes in headers, footers, text boxes etc.

Hi,

I'm using XMLNodes in Word documents. There is a problem if some of
them are
placed in stories other then Main Text Story (i.e. in headers/footers,
text
boxes etc.). In this case reading XMLNodes properties causes an error
for just opened
documents. If XMLNodes where manually selected after document
opening,
reading its properties works fine. It is illustrated by the following
VBA
procedure and its output (XMLNodes are in main text, text box and
header):


Sub XMLNodesProperties()
On Error GoTo ErrorHandler

Dim myStoryRange As Range
Dim node As XMLNode
Dim i As Integer

i = 1
For Each myStoryRange In ThisDocument.StoryRanges
For Each node In myStoryRange.XMLNodes
Debug.Print "Node" & i & ": " & "StoryType = " &
myStoryRange.StoryType & ", "
Debug.Print "BaseName = " & node.BaseName & vbCrLf
i = i + 1
Next
Next myStoryRange
Exit Sub
ErrorHandler:
Debug.Print "Err = " & Err.Number & ", " & "Description = " &
Err.Description & vbCrLf
Resume Next
End Sub


Output for just opened document:
Node1: StoryType = 1,
BaseName = Test

Node2: StoryType = 5,
Err = -2147467259, Description = Method 'BaseName' of object 'XMLNode'
failed

Node3: StoryType = 7,
Err = -2147467259, Description = Method 'BaseName' of object 'XMLNode'
failed


Output after selecting each XMLNode manually:
Node1: StoryType = 1,
BaseName = Test

Node2: StoryType = 5,
BaseName = Test

Node3: StoryType = 7,
BaseName = Test


Is there a way to read XMLNode properties without selecting them all?

Best regards,
Sergei

Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Can headers and footers be selected with body text? sandal Page Layout 4 April 10th 08 10:48 PM
Auto Text in Headers / Footers Keith Microsoft Word Help 1 July 14th 07 04:44 AM
How do I align text boxes in headers? lynneebee Microsoft Word Help 1 August 4th 06 12:20 AM
Text Wrapping - Headers and Footers!? A. Smart Microsoft Word Help 7 November 18th 05 06:18 PM
Headers and Footers/Auto Text gooner Microsoft Word Help 5 March 23rd 05 08:02 AM


All times are GMT +1. The time now is 03:51 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"