Measurement Studio for VB6

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQmx VBA for Excel 2003

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

0 Kudos
Message 1 of 8
(7,485 Views)

Can I get a little more clarification from you.  We don't sell a 6128. 

Applications Engineer
National Instruments
0 Kudos
Message 2 of 8
(7,474 Views)

sorry its a USB 6218

 

Peter

0 Kudos
Message 3 of 8
(7,470 Views)

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?

Applications Engineer
National Instruments
0 Kudos
Message 4 of 8
(7,468 Views)

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

 

0 Kudos
Message 5 of 8
(7,466 Views)

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.

Applications Engineer
National Instruments
0 Kudos
Message 6 of 8
(7,456 Views)

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

0 Kudos
Message 7 of 8
(7,454 Views)

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 

Applications Engineer
National Instruments
0 Kudos
Message 8 of 8
(7,447 Views)