Jump to content

As of July 17, 2015, the LabJack forums here at forums.labjack.com are shut down. New registrations, topics, and replies are disabled. All forums are in a read-only state for archive purposes.

Please visit our current forums at labjack.com/forums to view and make new posts. To post on the current forums, use your labjack.com login account. Your old LabJack forums login credentials have been retired. There are no longer separate logins for labjack.com and LabJack forums.


Set Output with EXCEL VBA

Output Excel VBA

  • Please log in to reply
1 reply to this topic

#1 volkhas

  • Members
  • 1 posts

Posted 16 July 2014 - 01:49 AM

Hello together!


I want to set different output values at the two output interfaces of the u12. Therefore I use a Excel VBA Macro which read values for voltages from a table. This values are written in a variable which should be sent to the interface.


If I try to run this macro i'll get the following error message: 'Runtime error 438'

The error is coming up for lngerrorcode.


This is the mean script:


Anzahl_Werte = Range("B4").End(xlDown).Row
Anzahl_Durchläufe = Range("H4").End(xlDown).Row

For j = 4 To Anzahl_Durchläufe
    For i = 4 To Anzahl_Werte
    'Range(Cells(4, 10), Cells(Anzahl_Werte, 13)) = Range(Cells(4, 3), Cells(Anzahl_Werte, 6)) * Cells(j, 8)
    Cells(i, 10) = Cells(i, 3) * Cells(j, 8)
    Cells(i, 11) = Cells(i, 4) * Cells(j, 8)
    Cells(i, 12) = Cells(i, 5) * Cells(j, 8)
    Cells(i, 13) = Cells(i, 6) * Cells(j, 8)
    sngAnalogOut0 = Cells(i, 12)
    sngAnalogOut1 = Cells(i, 13)
    lngErrorcode = Worksheets("Vorgaben").Ljackuwx1.AOUpdateX(-1, 0, lngStateD, lngStateIO, 0, 0, dblCount, sngAnalogOut0, sngAnalogOut1)


I hope you can help me. Thanks a lot!

#2 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 16 July 2014 - 11:58 AM

The 'Runtime error 438' is a VBA error that means "Object doesn't support this property or method.". Try the call "Ljackuwx1.AOUpdateX" instead of "Worksheets("Vorgaben").Ljackuwx1.AOUpdateX" and see if that helps. That's how we call functions in our examples. Also, make sure you are passing the correct data types for the parameters:




For our VBA and VB6 examples, take a look here:




Also tagged with one or more of these keywords: Output, Excel, VBA

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users