The method below is one way to loop through all Elements of the Active Document.
It is set to only open paragraph elements.
Click here for the best list of Elements is at w3.org.
Sub LoopingThroughAllElements()
On Error GoTo errHandler1
Dim strTagName As String
strTagName = "p"
For i = 0 To WebDesigner.Application. _
ActiveDocument.all.Length - 1
'Limit the files to be opened to htm files.
If WebDesigner.Application.ActiveDocument. _
all.Item(i).tagName = strTagName Then
'Code to Process Each Element Goes Here.
'blnChanged is set to true
'if changes have been made
'otherwise left at false
'so page does not need to be saved.
If blnChanged = True Then
WebDesigner.ActivePageWindow.Save True
blnChanged = False
End If
'WebDesigner.ActivePageWindow. _
Close False, False
End If
Next i
Exit Sub
errHandler1:
MsgBox _
"Err.Number: " & Err.Number & vbCrLf & _
"Err.Description: " & Err.Description, _
vbCritical, "GetQualifiedFileNames Function " & _
"had a Fatal Error."
End Sub