Returning an error message in a Com Object
Hi All,
I created a DLL that has one method connectionxml that parses a XML document and returns a connection string. Using this in multiple applications therefore I decided to create an object. Here's the code:
These are global
Dim XMLFileName As String
Dim objXML As New DOMDocument
Dim objXMLDOMNode As IXMLDOMNode
Function ConnectionXML()
Dim XMLFileName As String, XMLConnection As String
If Right$(App.Path, 1) = "\" Then
XMLFileName = App.Path & DBConnectionName
Else
XMLFileName = App.Path & "\" & DBConnectionName
End If
Set objXML = New DOMDocument
objXML.async = False
objXML.Load XMLFileName
For Each objXMLDOMNode In objXML.documentElement.childNodes
XMLConnection = objXMLDOMNode.childNodes.Item(0).Text & ";" & objXMLDOMNode.childNodes.Item(1).Text & ";" & objXMLDOMNode.childNodes.Item(2).Text
ConnectionXML = XMLConnection
Next
End Function
This is how I'm calling the method.
I compile and reference the DLL.
Dim objTestFunction As clsRoutines
Set objTestFunction = New clsRoutines
objTestFunction.ConnectionXML (XMLFileName)
I get the following error message
object variable or with block variable not set.
Any suggestions
Thanks