View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Marcos Hercules Marcos Hercules is offline
external usenet poster
 
Posts: 7
Default wanting to save HTML format in one sheet

Hi all,

Recently I did a VBA code that works with MSXML and save the result in
one another *.xls file, something like this

<?xml version="1.0" encoding="ISO-8859-1"?
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
<html
<table border="1"
width="70%"<tr<thdiscipline</th<thsuggests</th<thavailable</th<thnon
available</th</tr<tr<td<b1995-1999</b</td<td
align="center"2</td<td align="center"1</td<td align="center"1
</td</tr<tr<td<b2000-2005</b</td<td align="center"2</td<td
align="center"2</td<td align="center"0 </td</tr</table
</html

and now I wish that this same result it was showed right to my sheet1
and no more saving like other file.

See'm mycode


Dim app As New MSXML2.DOMDocument30

Dim xmlDom, xslDom, projDom, xslFileName As String

Dim xslt As New MSXML2.XSLTemplate30
Dim xslDoc As New MSXML2.FreeThreadedDOMDocument30
Dim xmlDoc As New MSXML2.DOMDocument30
Dim xslProc As IXSLProcessor
Dim xmlout As New MSXML2.FreeThreadedDOMDocument30
Dim oStream As New adodb.Stream
Dim oRecord As New adodb.Recordset
Set oStream = New adodb.Stream

oStream.Type = 1 'Binary


xslDoc.async = False
xslDoc.Load "c:\compara.xsl"



If (xslDoc.parseError.errorCode < 0) Then
Dim myErr
Set myErr = xslDoc.parseError
MsgBox ("Ha um erro " & myErr.reason)
Else
Set xslt.stylesheet = xslDoc
xmlDoc.async = False
xmlDoc.Load "C:\Instructional_program.xml"
If (xmlDoc.parseError.errorCode < 0) Then
Set myErr = xmlDoc.parseError
MsgBox ("You have error " & myErr.reason)
Else
oStream.Open

Set xslProc = xslt.createProcessor()
xslProc.input = xmlDoc
'xslProc.Transform
xslProc.output = oStream


xslProc.Transform

oStream.SaveToFile ("c:\Doc_out.xls")


oStream.Close


End If
End If