Hi,

First I'll give some background stuff... I am using a software called Netica VB API, downloaded from www.norsys.com and linked with VB in Excel via the tools/references/Netica 1.0 Object Library (if anyone wants to download and replicate the same set up to get the error). The ChestClinic.dne file can also be downloaded from norsys. I've tried attaching with this post but am unable to for some reason

With all this set up, I tried to run the following VB macro and obtained the error 91:“Object Variable or With Block Variable not set”.

Sub Main()
 
On Error GoTo Failed
Dim app As Netica.Application
app = New Netica.Application
app.Visible = True
Dim net_file_name As String
net_file_name = System.AppDomain.CurrentDomain.BaseDirectory() & "ChestClinic.dne"
Dim net As Netica.BNet
net = app.ReadBNet(app.NewStream(net_file_name))
net.Compile
Dim TB As Netica.BNode
TB = net.Nodes.Item("Tuberculosis")
Dim belief As Double
belief = TB.GetBelief("present")
MsgBox ("The probability of tuberculosis is " & belief)
net.Nodes.Item("XRay").EnterFinding ("abnormal")
belief = TB.GetBelief("present")
MsgBox ("Given an abnormal X-Ray, the probability of tuberculosis is " & belief)
net.Nodes.Item("VisitAsia").EnterFinding ("visit")
belief = TB.GetBelief("present")
MsgBox ("Given abnormal X-Ray and visit to Asia, the probability of tuberculosis is " & belief)
net.Nodes.Item("Cancer").EnterFinding ("present")
belief = TB.GetBelief("present")
MsgBox ("Given abnormal X-Ray, Asia visit, and lung cancer, the probability of tuberculosis is " & belief)
net.Delete
If Not app.UserControl Then
    app.Quit
End If
Exit Sub
Failed:
MsgBox ("NeticaDemo: Error " & (err.Number And &H7FFF) & ": " & err.Description)
End Sub
To try to solve this error I went onto the Microsoft website and used the information in the following link:

http://support.microsoft.com/default...b/188919/en-us

However this does not solve the issue.

Can anyone help me remove this error??? I have absolutely no idea of OLE objects and their effect on anything...

Thanks,

Tracey.