I have the following code:
Dim xmlSource
Dim xmlXForm
Dim strErr
Dim strResult
Dim fso , file
Dim strPath
Const ForReading = 1
Const ForWriting = 2
Const ForAppending = 8
Set xmlSource = CreateObject("MSXML.DOMDocument")
Set xmlXForm = CreateObject("MSXML.DOMDocument")
xmlSource.validateOnParse = True
xmlXForm.validateOnParse = True
xmlSource.async = False
xmlXForm.async = False
xmlSource.Load "c:\Downloads\testme.xml" ' This loads the text that I want to transform
If Err.Number <> 0 Then
strErr = Err.Description & vbCrLf
strErr = strErr & xmlSource.parseError.reason & " line: " & xmlSource.parseError.Line & " col: " & xmlSource.parseError.linepos & " text: " & xmlSource.parseError.srcText
MsgBox strErr, vbCritical, "Error loading the XML"
End If
xmlXForm.Load "c:\Downloads\testme.xsl" ' This loads the XSLT transform
If Err.Number <> 0 Then
strErr = Err.Description & vbCrLf
strErr = strErr & xmlSource.parseError.reason & " line: " & xmlSource.parseError.Line & " col: " & xmlSource.parseError.linepos & " text: " & xmlSource.parseError.srcText
MsgBox strErr, vbCritical, "Error loading the Transform"
End If
strResult = xmlSource.transformNode(xmlXForm) ' This transforms the data in xmlSource
If Err.Number <> 0 Then
strErr = Err.Description & vbCrLf
strErr = strErr & xmlSource.parseError.reason & " line: " & xmlSource.parseError.Line & " col: " & xmlSource.parseError.linepos & " text: " & xmlSource.parseError.srcText
MsgBox strErr, vbCritical, "Error executing the Transform"
End If
Set fso = CreateObject("Scripting.FileSystemObject")
strPath = "c:\Downloads\testme.txt"
' open the file
Set file = fso.opentextfile(strPath, ForWriting, True)
' write the info to the file
file.write strResult
' close and clean up
file.Close
Set file = Nothing
Set fso = Nothing
Set xmlSource = Nothing
Set xmlXForm = Nothing
'----------
The problem exists when the execution hits this row:
Set fso = CreateObject("Scripting.FileSystemObject")
I get the following error message:
Windows Script Host
Script: C:\Downloads\xml2csv_src\testme.vbs
Line: 42
Char: 3
Error: The specified module could not be found.
Code: 8007007E
Source: (null)
Can anyone tell me what this error message means and how I correct the problem? I have googled this thing to death and couldn't find an entry to match this problem. Thanks for all help in advance.
Dave
Dim xmlSource
Dim xmlXForm
Dim strErr
Dim strResult
Dim fso , file
Dim strPath
Const ForReading = 1
Const ForWriting = 2
Const ForAppending = 8
Set xmlSource = CreateObject("MSXML.DOMDocument")
Set xmlXForm = CreateObject("MSXML.DOMDocument")
xmlSource.validateOnParse = True
xmlXForm.validateOnParse = True
xmlSource.async = False
xmlXForm.async = False
xmlSource.Load "c:\Downloads\testme.xml" ' This loads the text that I want to transform
If Err.Number <> 0 Then
strErr = Err.Description & vbCrLf
strErr = strErr & xmlSource.parseError.reason & " line: " & xmlSource.parseError.Line & " col: " & xmlSource.parseError.linepos & " text: " & xmlSource.parseError.srcText
MsgBox strErr, vbCritical, "Error loading the XML"
End If
xmlXForm.Load "c:\Downloads\testme.xsl" ' This loads the XSLT transform
If Err.Number <> 0 Then
strErr = Err.Description & vbCrLf
strErr = strErr & xmlSource.parseError.reason & " line: " & xmlSource.parseError.Line & " col: " & xmlSource.parseError.linepos & " text: " & xmlSource.parseError.srcText
MsgBox strErr, vbCritical, "Error loading the Transform"
End If
strResult = xmlSource.transformNode(xmlXForm) ' This transforms the data in xmlSource
If Err.Number <> 0 Then
strErr = Err.Description & vbCrLf
strErr = strErr & xmlSource.parseError.reason & " line: " & xmlSource.parseError.Line & " col: " & xmlSource.parseError.linepos & " text: " & xmlSource.parseError.srcText
MsgBox strErr, vbCritical, "Error executing the Transform"
End If
Set fso = CreateObject("Scripting.FileSystemObject")
strPath = "c:\Downloads\testme.txt"
' open the file
Set file = fso.opentextfile(strPath, ForWriting, True)
' write the info to the file
file.write strResult
' close and clean up
file.Close
Set file = Nothing
Set fso = Nothing
Set xmlSource = Nothing
Set xmlXForm = Nothing
'----------
The problem exists when the execution hits this row:
Set fso = CreateObject("Scripting.FileSystemObject")
I get the following error message:
Windows Script Host
Script: C:\Downloads\xml2csv_src\testme.vbs
Line: 42
Char: 3
Error: The specified module could not be found.
Code: 8007007E
Source: (null)
Can anyone tell me what this error message means and how I correct the problem? I have googled this thing to death and couldn't find an entry to match this problem. Thanks for all help in advance.
Dave