PicoHRDL.dll problems with Excel VBA

 
Post new topic   Reply to topic    Pico Technology Forum Index -> VB and VBA (Excel, Access)
Author Message
RobNewbury
User
User


Joined: 26 Jul 2008
Posts: 2
Location: South West UK

PostPosted: Sat Jul 26, 2008 4:34 pm    Post subject: PicoHRDL.dll problems with Excel VBA Reply with quote

I am having problems with VBA code that uses the PicoHRDL.dll in conjunction with ADC-20 logger.

The Excel application crashes either while the VBA is running or a little while after.

This happens even with the supplied example spread sheet HRDL.XLS. I have tried on three different computers (but with same ADC-20) and get the problem with them all.

Can't tie the crash down to a particular line of code in the VBA, it seems that once the call to HRDLRun(handle, 100, 0) has been made the crash could occure at any time. Sometimes the VBA program will complete and update the spread sheet but still get the "program not responding" message when Excel is exited. When this happens re-running Excel and loading the HRDL.XLS spread sheet gives the spread sheet locked for editing as already in use (by me!!) error. If the ADC-20 is unplugged and re-plugged from the USB port before re-loading HRDL.XLS, then the spread sheet is not locked for editing.
Back to top
RobNewbury
User
User


Joined: 26 Jul 2008
Posts: 2
Location: South West UK

PostPosted: Mon Jul 28, 2008 8:25 am    Post subject: PicoHRDL.dll problems with Excel VBA Reply with quote

Having done some more work on this, with regard to the example macro in HRDL.XLS, it turns out that the problem comes at the call to HRDLGetTimesAndValues(handle, times(0), values(0), 0, 100).
There are some problems with this call, firstly the fourth paramater should be a pointer to Overflow of type single, whereas it is called as a variable of type single. Also on closer inspection I found that the decleration for this function is wrong and is defined as Declare Function HRDLGetTimesAndValues Lib "C:\EDisc\examples\Excel\HRDL\PicoHRDL.dll" (ByVal handle As Integer, times As Long, values As Long, ByRef overflow As Integer, ByVal noOfValues As Long) As Long, both the variables times and values should be pointers, so the decleration should read:-
Declare Function HRDLGetTimesAndValues Lib "C:\EDisc\examples\Excel\HRDL\PicoHRDL.dll" (ByVal handle As Integer, ByRef times As Long, ByRef values As Long, ByRef overflow As Integer, ByVal noOfValues As Long) As Long

Some of these issues could explain why Excel crashes after the call as some memory locations that should be pointers will be screwed up.

... Even so having made these corrections to the example macro HRDL.XLS, the Excel application will still crash at some point after the call to HRDLGetTimesAndValues has been made.
I have found that replacing HRDLGetTimesAndValues with a call to HRDLGetValues does not cause Excel to crash.

.. Some assistance with this would be appreciated.
Back to top
ziko
Site Admin
Site Admin


Joined: 01 Dec 2006
Posts: 667
Location: St Neots

PostPosted: Thu Aug 07, 2008 12:36 pm    Post subject: Reply with quote

Hi I have managed to recreate your problem. I have reported this as a bug report.

Kind regards
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Pico Technology Forum Index -> VB and VBA (Excel, Access)
All times are GMT
Page 1 of 1

 


Pico Technology topic RSS feed 
Powered by phpBB © 2001, 2005 phpBB Group