Click here to Skip to main content
16,010,876 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Issue with printing floating point numbers Pin
Andy_L_J30-Jan-08 18:43
Andy_L_J30-Jan-08 18:43 
GeneralRe: Issue with printing floating point numbers Pin
Johan Hakkesteegt29-Jan-08 8:01
Johan Hakkesteegt29-Jan-08 8:01 
Generalmouse right click.... Pin
moomoooomoo28-Jan-08 17:22
moomoooomoo28-Jan-08 17:22 
GeneralRe: mouse right click.... Pin
nishkarsh_k28-Jan-08 18:12
nishkarsh_k28-Jan-08 18:12 
GeneralRe: mouse right click.... Pin
Steven J Jowett28-Jan-08 22:40
Steven J Jowett28-Jan-08 22:40 
QuestionReporting Services in VB Pin
di3.ny2828-Jan-08 15:42
di3.ny2828-Jan-08 15:42 
QuestionShape and line controls for VB6, only a little more interactive? Pin
Nick Alexeev28-Jan-08 11:34
professionalNick Alexeev28-Jan-08 11:34 
GeneralVB - Read XML data and Export to Excel Pin
VladFromNYC28-Jan-08 7:23
VladFromNYC28-Jan-08 7:23 
This is more of a VB thing because I am planning to execute it inside of the SQL 2000 DTS package but I am testing it in VB.Net app. It has been a while since I've worked with XML and I got stumbled with a simple one here!!

I just need to read Detail/DT and Detail/Accounts XML in the loop - I don't think my XPath is correct.
Somehow data that I read is not pasted into Excel document. What am I doing wrong. Please help.

Many Thanks!!!


<code>
<report xmlns="_x0031_000ImprAccount" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemalocation="_x0031_000ImprAccount " name="10Impr">
<table1>
<detail_collection>
<detail dt="2008-01-01T00:00:00" accounts="203" />
<detail dt="2008-01-02T00:00:00" accounts="219" />
<detail dt="2008-01-03T00:00:00" accounts="224" />
</detail_collection>
</table1>
</report>
</code>

xlapp = CreateObject("Excel.Application")


xlapp.Workbooks.Add()

xlapp.ScreenUpdating = False

DateMsg = "Generated on - " + FormatDateTime(Now(), 0)
' Load the xml file

strFileName = "C:\test.xml"

oDoc = CreateObject("MSXML2.DOMDocument")
oDoc.async = False

oDoc.validateOnParse = True

oDoc.Load(strFileName)

Detail = "Detail"

If oDoc.parseError.errorCode = 0 Then

R = 0

C = 0

xPath = "//Detail_Collection"

DetailCollection = oDoc.selectNodes(xPath)

Dim bookTitle, bookAuthor
For Each Detail In DetailCollection



DetailAccount = Detail.SelectSingleNode("Detail[@Accounts]").text ' Not sure if XPath is correct here..

xlapp.ActiveCell.Offset(R, C).Value = DetailAccount ' Copy to Excel

Next


End If



'Save Excel File

Dim filo

Dim Awkbk
Dim savefile

filo = "C:\testexcel.xls"

Awkbk = xlapp.ActiveWorkbook

savefile = Awkbk.SaveAs(filo, -4143, , , , , )
<code></code>
GeneralRe: VB - Read XML data and Export to Excel Pin
Johan Hakkesteegt29-Jan-08 8:21
Johan Hakkesteegt29-Jan-08 8:21 
GeneralRunning a Dos command in VB .net Pin
saravana00128-Jan-08 7:15
saravana00128-Jan-08 7:15 
GeneralRe: Running a Dos command in VB .net Pin
pmarfleet28-Jan-08 8:31
pmarfleet28-Jan-08 8:31 
Generaloverriding wndproc - need constants Pin
Smithers-Jones28-Jan-08 5:52
Smithers-Jones28-Jan-08 5:52 
GeneralCertificates Pin
KreativeKai28-Jan-08 5:29
professionalKreativeKai28-Jan-08 5:29 
GeneralRe: Certificates Pin
Mycroft Holmes28-Jan-08 19:01
professionalMycroft Holmes28-Jan-08 19:01 
GeneralRe: Certificates Pin
KreativeKai29-Jan-08 4:05
professionalKreativeKai29-Jan-08 4:05 
GeneralRe: Certificates Pin
Mycroft Holmes29-Jan-08 14:39
professionalMycroft Holmes29-Jan-08 14:39 
GeneralRe: Certificates Pin
KreativeKai31-Jan-08 2:33
professionalKreativeKai31-Jan-08 2:33 
Generalsystem.thread.sleep Pin
solarthur0128-Jan-08 4:15
solarthur0128-Jan-08 4:15 
GeneralRe: system.thread.sleep Pin
Colin Angus Mackay28-Jan-08 5:58
Colin Angus Mackay28-Jan-08 5:58 
GeneralRe: system.thread.sleep Pin
solarthur0128-Jan-08 6:29
solarthur0128-Jan-08 6:29 
GeneralFormating Excel sheet by VB.Net Pin
Pradip Kishore28-Jan-08 1:52
Pradip Kishore28-Jan-08 1:52 
GeneralRe: Formating Excel sheet by VB.Net Pin
Justin Perez28-Jan-08 3:16
Justin Perez28-Jan-08 3:16 
QuestionVBA for Outlook Question Pin
wjtaylor28-Jan-08 1:31
wjtaylor28-Jan-08 1:31 
Questionhow to control the left button of the mouse Pin
saadmechiche28-Jan-08 1:05
saadmechiche28-Jan-08 1:05 
AnswerRe: how to control the left button of the mouse Pin
Johan Hakkesteegt28-Jan-08 6:26
Johan Hakkesteegt28-Jan-08 6:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.