Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
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 |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Can headers and footers be selected with body text? | Page Layout | |||
Auto Text in Headers / Footers | Microsoft Word Help | |||
How do I align text boxes in headers? | Microsoft Word Help | |||
Text Wrapping - Headers and Footers!? | Microsoft Word Help | |||
Headers and Footers/Auto Text | Microsoft Word Help |