By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,558 Members | 1,210 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,558 IT Pros & Developers. It's quick & easy.

Read an XML document using VBA

P: 8
I want to be able to parse through an xml document and in the example below, I'm just extracting the data between nodes to a message box. I want to be able to iterate through each node (for the first 10).

Sub x()
Dim strBeginTag As String
Dim strEndTag As String
Dim intUnit As Integer
Dim strBuf As String
Dim count As Integer

intUnit = FreeFile
Open "C:\Documents and Settings\me\Desktop\myDoc.xml"

For Input As intUnit
strBuf = Input(LOF(intUnit), #intUnit)
Close intUnit

For count = 0 To 10
strBeginTag = "<node>"
strEndTag = "</node>"
MsgBox ExtractBetween(strBeginTag, strEndTag, strBuf)
Next count
End Sub

'Below this i have the code to extract the data between nodes. This currently only reads the first node. Is the any way to continue reading the rest of the nodes in the xml?
Dec 28 '07 #1
Share this Question
Share on Google+
1 Reply

Expert 100+
P: 807
I woukd suggest using MSXML as a parser, see
Dec 31 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.