Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

VI_NULL required in new NI VISA version

Hi,

 

After I download latest NI-VISA 5.0.3, my VBA code doesn't work anymore. There is an error message

 

" VI_NULL : constant expression required" in below command

 

 stat = viOpen(defaultRM, "TCPIP::xx.xx.xxx.xx::5000::SOCKET", VI_NULL, VI_NULL, sesn)

 

I don't know what number is proper for this VI_NULL.

 

Also I want to remove latest VISA version and use old one (4.6.2) . How could I do that? NI-VISA can't be removed as a normal software.

 

Thanks

0 Kudos
Message 1 of 6
(5,249 Views)

The syntax is explained in the NI-VISA help and of course you can uninstall it. Select 'National Instruments Software' and see the list.

0 Kudos
Message 2 of 6
(5,248 Views)

Thanks. I know how to uninstall the VISA.

 

But I still get that error message about VI_NULL. Any idea what happens?

 

On the same PC, I updatedTekVISA . Then when I update NIVISA to latest version, NIVISA renamed original VISA32.dll to be tek.visa32.dll. I includeVISA32.dll in my VBA code and see the error message for VI_NULL .

0 Kudos
Message 3 of 6
(5,244 Views)

Try the VB keyword NULL.

 

0 Kudos
Message 4 of 6
(5,236 Views)

Thanks.

 

I changed VI_NULL to be NULL 

stat = viOpen(defaultRM, "TCPIP::xx.xx.xxx.xx::xxxx::SOCKET", Null, Null, sesn) 

 

and an error meassge pops up " Invalid use of NULL".

 

Do we need modify the viOpen command?

0 Kudos
Message 5 of 6
(5,232 Views)

VI_NULL is a constant defined in the file visa32.bas which is included with NI-VISA.  We should make sure that visa32.bas is included in the VB project and that the file still exists where the project thinks it's located.  This file could be installed in different locations over time -- latest install of NI-VISA may have installed it in a place different than the VB project expects it.

 

After search for visa32.bas and load it into VB project, the code has no more error

0 Kudos
Message 6 of 6
(5,209 Views)