Example Code

Archived: Calling NI-488.2 Functions Directly in Excel

Code and Documents

Attachment

Overview


This document has been archived and is no longer updated by National Instruments.

This example calls NI-488.2 functions in Excel through the Visual Basic for Applications (VBA) interface. In most cases you will find that Measure provides the GPIB functionality that you need, but if you need some advanced access to the NI-488.2 driver, you can use this example. This example is a conceptual program and has not been fully tested with every GPIB function, so it may not be 100% reliable. Nevertheless it is a good resource to demonstrate how to access the NI-488.2 driver directly through VBA.

The example is pretty well commented and comes with the code modules for the language interface. To create the language interface you must comment out a couple of lines in the original Visual Basic language interface (these are right near the top of the module) that are not supported in VBA as well as change one of the data types to integer from byte (byte is not supported in VBA). All of the modified lines have been commented.

This example has only been tested with Microsoft Excel v7.0 (the one that ships with Office 95) and NI-488.2M v1.2 for Windows 95. It should be portable to newer versions of Excel and to Windows NT but this has not been tested.

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
RandyLab
Member
Member
on

When I download this example, the macro is stripped from the spread sheet, do I need to do something to pull the macro with the spread sheet

 

Contributors