03-16-2011 08:59 AM
Hi,
I'm trying to control a NI6128 via VBA. I'm using Excel 2003 and tried several of the samples I found in the developer Zone, none of them seem to run. I think there is a fundamental error somewhere.
But, the VB6 drivers suppose to run under VBA and that is suppose to work under Excel 2003?
Peter
03-17-2011 11:47 AM
Can I get a little more clarification from you. We don't sell a 6128.
03-17-2011 01:04 PM
sorry its a USB 6218
Peter
03-17-2011 01:56 PM
What examples exactly did you try to run and when you say they didn't work, did you get an error or did they just plain not work?
03-17-2011 02:29 PM
here is the file I tried
status is -20012
after the Status = DAQmxWriteDigitalLines(taskHandle, 1, True, 1, DAQmx_Val_GroupByChannel, writeArray(0), sampsPerChanWritten, ByVal 0&)
function
Peter
03-18-2011 10:47 AM
Check out some of these links about programming in VBA. You might have to make some of your own code, I haven't been able to get those examples to run either.
http://digital.ni.com/public.nsf/allkb/B22FE2B0F9C8935286256E920073DA07?OpenDocument
http://digital.ni.com/public.nsf/allkb/735848148B5B4964862571F5004692C7?OpenDocument
http://digital.ni.com/public.nsf/websearch/B22FE2B0F9C8935286256E920073DA07?OpenDocument
I hope that this helps.
03-18-2011 11:09 AM
would be nice to get a sample that really works. I could take it from there.
the links to the installed samples on the C drive is a pain, since often the installer won't install them if you don't have VB6 studio installed (which you don't need for VBA)
Peter
03-18-2011 03:08 PM
Peter,
After a lot of test I was able to get this example to work. Essentially I wired my P0.0 channel to my P0.1 channel with a piece of wire. I then changed the configure port macro to only configure port 0 and channel zero. In Measurement and Automation Explorer I set up a task to read the digital line from P0.1. I then ran this task. Then I ran the macros by hitting configure ports and then both write buttons. The write buttons turn the digital line on and off in Measurement and Automation. Try doing this and let me know how it goes. It may be a driver or hardware issue if you cannot get it to work.
Brian