Hello Everyone,
I have some code (which you can find below) and I am able to compile it correctly on my computer but when I copy and paste it into another computer (for further development); I get the error: "Object reference not set to an instance of an object". I have provided a screen shot of the error and the pertinent code below. As you can see from the screen shot the error occurs in the line: " If Dir(pfile(j)) = "" Then".
I can't for the life of me figure out why the code works on one computer and not on another. Any help will be greatly appreciated.
I have some code (which you can find below) and I am able to compile it correctly on my computer but when I copy and paste it into another computer (for further development); I get the error: "Object reference not set to an instance of an object". I have provided a screen shot of the error and the pertinent code below. As you can see from the screen shot the error occurs in the line: " If Dir(pfile(j)) = "" Then".
Code:
Sub ChartPlot()
Dim i As Integer
Dim j As Integer
Dim KF As Integer
Dim J1 As Integer
Dim J2 As Integer
Dim JLG As Integer
Dim NPTS As Integer
Dim IPLOT(4, 5) As Object 'changed from integer
Dim ICC(5) As Integer
Dim ICLOSE As Integer
Dim ICONX As Integer
Dim FILEGRAPH As String
Dim pfile(5) As String
Dim Lgnd(5) As String
'Dim VP1!(), VPC1!() Double Precision change
Dim VP1(,) As Double
Dim VPC1(,) As Double
Dim Crve As MSChart20Lib.Series
'Dim VL!()
Dim VL() As Double
'On Error GoTo 200 'removed for debugging
IREADT = 0
'Read Table Data
VSFlexGrid1.Row = 0
For j = 1 To 5
VSFlexGrid1.Col = j
pfile(j) = VSFlexGrid1.Text
If Dir(pfile(j)) = "" Then
Mss(1) = "File " & pfile(j) & " can ot be found"
Call ErrMessF()
Exit Sub
End If
Next
end sub
I can't for the life of me figure out why the code works on one computer and not on another. Any help will be greatly appreciated.