View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default read xml and fill valuesin excel form combobox


Sub Gettext()

Const ForReading = 1, ForWriting = 2, ForAppending = 3
Const TxtDirectory = "C:\temp\test\"
Const ReadFileName = "test.xml"
Const TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0

Set fsread = CreateObject("Scripting.FileSystemObject")
ReadPathName = TxtDirectory & ReadFileName
Set fread = fsread.GetFile(ReadPathName)
Set tsread = fread.OpenAsTextStream(ForReading, TristateUseDefault)

Do While tsread.atendofstream = False

inputline = tsread.ReadLine
If Left(inputline, 6) = "<name" Then
newname = Mid(inputline, 7)
newname = Left(newname, InStr(newname, "<") - 1)
ActiveSheet.ComboBox1.AddItem newname
End If
'add filter code here
Loop
tsread.Close

End Sub

"born2achieve" wrote:

dear friend, this is my xml, , here i need to read the name and display in
combobox pleasehelp me

<?xml version="1.0"?
<data
<student
<id1</id
<nameRaymond</name
<age11</age
<mark0</mark
<designationengneer</designation
</student


<student<id2</id
<nameMoon</name
<age11</age
<mark100</mark
<designationblody</designation
</student


<student<id3</id
<nameBilly</name
<age11</age
<mark100</mark
<designationpassd</designation
</student


<student<id4</id
<namePan</name
<age12</age
<mark80</mark
<designationvhonr</designation
</student


<student<id5</id
<nameQueenie</name
<age10</age
<mark90</mark
<designationsogjg</designation
</student


</data