Click here to Skip to main content
15,887,361 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Load method with file URL file location reference Pin
Member 1066669820-May-14 5:44
Member 1066669820-May-14 5:44 
QuestionListing Directory using FTPwebrequest and updating DB tables Pin
Sachin k Rajput 19-May-14 3:33
Sachin k Rajput 19-May-14 3:33 
QuestionVBScript: Conversion XML to Excel Pin
Member 1066669818-May-14 21:39
Member 1066669818-May-14 21:39 
AnswerRe: VBScript: Conversion XML to Excel Pin
Chris Quinn18-May-14 22:52
Chris Quinn18-May-14 22:52 
GeneralRe: VBScript: Conversion XML to Excel Pin
Member 1066669818-May-14 23:05
Member 1066669818-May-14 23:05 
GeneralRe: VBScript: Conversion XML to Excel Pin
Chris Quinn18-May-14 23:32
Chris Quinn18-May-14 23:32 
GeneralRe: VBScript: Conversion XML to Excel Pin
Member 1066669819-May-14 1:10
Member 1066669819-May-14 1:10 
GeneralRe: VBScript: Conversion XML to Excel Pin
Member 1066669819-May-14 2:37
Member 1066669819-May-14 2:37 
Okay, this seems like a confirmed bug:
http://support.microsoft.com/kb/307230/en-US

The solution is to convert to HTML first, then to xls. The workaround code in VBA:

VB
Sub Macro3()
    'Load the XML and the XSL (the stylesheet).
    Dim oXML As Object, oXSL As Object
    Set oXML = CreateObject("MSXML.DOMDocument")
    Set oXSL = CreateObject("MSXML.DOMDocument")
    oXML.Load "c:\customers.xml"
    oXSL.Load "c:\customers.xsl"

    'Transform the XML using the stylesheet.
    Dim sHTML As String
    sHTML = oXML.transformNode(oXSL)

    'Save the results to an HTML file.
    Open "c:\customers.htm" For Output As #1
    Print #1, sHTML
    Close #1

    'Automate Excel to open the HTML file.
    Dim oApp As Excel.Application
    Set oApp = CreateObject("excel.application")
    oApp.Visible = True
    oApp.Workbooks.Open "c:\customers.htm"
End Sub


This fails when trying to save the HTML file, presumably because the file cannot be referenced that way in VBScript:

VB
Open "c:\customers.htm" For Output As #1


What do I need to change to save this as HTML?

p.s. I realise this forum is VB but I could not find a disgnated VBScript section
GeneralRe: VBScript: Conversion XML to Excel Pin
Eddy Vluggen19-May-14 2:59
professionalEddy Vluggen19-May-14 2:59 
GeneralRe: VBScript: Conversion XML to Excel Pin
Member 1066669819-May-14 3:10
Member 1066669819-May-14 3:10 
GeneralRe: VBScript: Conversion XML to Excel Pin
Chris Quinn19-May-14 3:15
Chris Quinn19-May-14 3:15 
GeneralRe: VBScript: Conversion XML to Excel Pin
Eddy Vluggen19-May-14 7:39
professionalEddy Vluggen19-May-14 7:39 
QuestionVB.Net 2008 Pin
Virendra Singh Bhanu16-May-14 0:29
Virendra Singh Bhanu16-May-14 0:29 
AnswerRe: VB.Net 2008 Pin
Richard MacCutchan16-May-14 0:50
mveRichard MacCutchan16-May-14 0:50 
GeneralRe: VB.Net 2008 Pin
Virendra Singh Bhanu16-May-14 0:56
Virendra Singh Bhanu16-May-14 0:56 
GeneralRe: VB.Net 2008 Pin
Richard MacCutchan16-May-14 1:14
mveRichard MacCutchan16-May-14 1:14 
QuestionRe: VB.Net 2008 Pin
Eddy Vluggen16-May-14 3:02
professionalEddy Vluggen16-May-14 3:02 
QuestionList(Of ObjectWithProperties) distinct property values Pin
Johan Hakkesteegt15-May-14 3:32
Johan Hakkesteegt15-May-14 3:32 
AnswerRe: List(Of ObjectWithProperties) distinct property values Pin
Richard MacCutchan15-May-14 3:49
mveRichard MacCutchan15-May-14 3:49 
AnswerRe: List(Of ObjectWithProperties) distinct property values Pin
David Mujica15-May-14 6:32
David Mujica15-May-14 6:32 
AnswerRe: List(Of ObjectWithProperties) distinct property values Pin
Eddy Vluggen15-May-14 7:53
professionalEddy Vluggen15-May-14 7:53 
GeneralRe: List(Of ObjectWithProperties) distinct property values Pin
Johan Hakkesteegt15-May-14 20:16
Johan Hakkesteegt15-May-14 20:16 
GeneralRe: List(Of ObjectWithProperties) distinct property values Pin
Mycroft Holmes15-May-14 22:41
professionalMycroft Holmes15-May-14 22:41 
QuestionWindow Service Does Not Stay "Alive" While Running Pin
ToolTimeTabor14-May-14 15:13
ToolTimeTabor14-May-14 15:13 
AnswerRe: Window Service Does Not Stay "Alive" While Running Pin
Bernhard Hiller14-May-14 21:51
Bernhard Hiller14-May-14 21:51 

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.