Visual Basic, VB6, VBA for LJM - Windows | LabJack
« Close

Datasheets and User Guides

App Notes

Software & Driver


Visual Basic, VB6, VBA for LJM - Windows

LJM Visual Basic/VB6/VBA Wrapper/Examples (Software Platform)

Visual Basic for Applications (VBA) and Visual Basic 6 (VB6) module and examples for the LJM library.


LJM Visual Basic/VB6/VBA Wrapper/Examples Top (Referencable)

Includes a VB6 project and a VBA Excel example. For Visual Basic .NET examples, go to the C# and VB .NET examples page.

Note to VBA Users: The VB6 example demonstrates additional LJM usage. VB6 code can be used in VBA, so take a look at the VB6 example as well. The VB6 example's .frm file contains the source code and can be opened in any text editor.


  • LabJack T7 or T4
  • LJM Library - Install the LJM Library
  • Applications that support VBA (such as Excel), or Visual Basic 6
  • Operating system - Windows

LJM Examples Where Is An Example To Do XYZ Minimal (Referencable)

Communication Basics

With the LJM library, pretty much everything you might want to do with a device is accomplished by writing and/or reading some registers.  Look at the device's datasheet (T7 or T4) or the Modbus Map to determine what registers you need to write and read, then use eWriteName (or eWriteNames) to write the desired registers and eReadName (or eReadNames) to read the desired registers.

LJM Visual Basic/VB6/VBA Wrapper/Examples Bottom (Referencable)

File list contains:



T7-Pro OEM version.

Is it possible to send and receive data from the board under vb6 used as GUI?

from VB6 GUI sending cmd like mscomm.output a,123 data...

how it is done in vb6 to send similar data in wifi, Eternet?


Yes, It is possible to send and receive data from the board in VB6.  First open the device using the OpenS() or Open() functions, then use the handle to write or read values from the device. The open call is very similar for WiFi, Ethernet and USB, simply use OpenS(T7, WiFi, ANY), or OpenS(T7, Ethernet, ANY), or OpenS(T7, USB, ANY).  See LJM_OpenS for more details on the open call.

Have you thought of making it a com object that can call its own memory and thread. This would allow for use in Dot Net and C# J# VB C++ calls with out much trouble in coding. Since VBA is nice to use inside excel spread sheets but would be more use full to attach to web services or other custom services.  If the peek poke driver was built in a COM object interface the porting would be more easier to all application models. 

Just wondering?


With simple VBA example done in Excel 2000, when I run it I got 1298 LJME_ATTR_LOAD_COMM_FAILURE. Running in excel 2013

Usually that error occurs when you are trying to open an unsupported device in the LJM driver. The LJM driver, which this example uses, only supports the T7 and Digit currently. If you are using a UE9, U6 or U3, use the examples from here:

If you are using a T7 and are getting this error, can you tell us the connection type you are trying to use (Any, USB, Ethernet, TCP, or WiFi). If you didn't modify the example's VBA code the connection type is Any.'s picture

I have downloaded and installed LJM Library and the VBA examples but cannot find the ocx file anywhere!?

labjack support's picture

The active-x component ljackuwx.ocx is for the U12 and is not used by the LJM VB examples.