Hello Forum Members,
I've recently started on a program to calculate the delivery costs, and I've stumbled upon some very frustrating problems.
I read some topics on this site, and I was hoping the experienced people on this forum could help me with this problem.
My problem is the following, I'm trying to get some cells out of Excel and letting it show in lstPrijs, in VB6.
I'm getting this problem:
"The instruction at "0x30a666d5" referenced memory at "0x0065008e". The memory could not be "read".
Click on OK to terminate the program
Click on CANCEL to debug the program"
Excel stays open this way, the code I'm using is:
I've tried debugging, but it then says there was a problem with Excel and it will now be terminated. This leaves me to the conclusion that there is a problem with Excel.
I've tried doing something with the ODBC feature, but I don't know what I'm doing wrong.
I don't know how to use the DOA, although I've installed it when I installed Microsoft Query.
The number does in fact show up in lstPrijs, but after the number shows, the error comes. So it must be after that part of the code, I believe.
My second problem is when I've clicked the 50kg and the 10-39, it shows the correct amount in lstPrijs, ofcourse with the error. But then if I click 90-99, it shows all the numbers from the H section in excel, where he's supposed to bring up the same number as the 10-39.
I'm desperate and I hope that someone can help me.
Thanks in advance,
Q~
I've recently started on a program to calculate the delivery costs, and I've stumbled upon some very frustrating problems.
I read some topics on this site, and I was hoping the experienced people on this forum could help me with this problem.
My problem is the following, I'm trying to get some cells out of Excel and letting it show in lstPrijs, in VB6.
I'm getting this problem:
"The instruction at "0x30a666d5" referenced memory at "0x0065008e". The memory could not be "read".
Click on OK to terminate the program
Click on CANCEL to debug the program"
Excel stays open this way, the code I'm using is:
Code:
Sub BelgPo ()
Dim xl As Object
Dim xlsheet As Object
Dim xlwbook As Object
Set xl = CreateObject("Excel.Application")
Set xlwbook = xl.Workbooks.Open("c:\Verzend\Bosman2.xls", , True)
Set xlsheet = xlwbook.Sheets.Item("Belg")
If lstGewicht = "t/m 50kg" And lstPostcode = "10-39" Or lstGewicht = "t/m 50kg" And lstPostcode = "90-99" Then
Me.lstPrijs.AddItem (xlsheet.range("h5").value)
End If
xl.ActiveWorkbook.Close False, "c:\Verzend\Bosman2.xls"
xl.Quit
Set xl = Nothing
Set xlwbook = Nothing
Set xlsheet = Nothing
End Sub
I've tried debugging, but it then says there was a problem with Excel and it will now be terminated. This leaves me to the conclusion that there is a problem with Excel.
I've tried doing something with the ODBC feature, but I don't know what I'm doing wrong.
I don't know how to use the DOA, although I've installed it when I installed Microsoft Query.
The number does in fact show up in lstPrijs, but after the number shows, the error comes. So it must be after that part of the code, I believe.
My second problem is when I've clicked the 50kg and the 10-39, it shows the correct amount in lstPrijs, ofcourse with the error. But then if I click 90-99, it shows all the numbers from the H section in excel, where he's supposed to bring up the same number as the 10-39.
I'm desperate and I hope that someone can help me.
Thanks in advance,
Q~