Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Not read NI VISA head file when migrate from Excel2007 (Window XP) to Excel2013 (Window7).

I have a MS Excel VBA macro that use NI USB-GPIB-HS port to control oscilloscope. This macro works well in Excel 2007 (which is 32bit) installed in window XP (which is also 32 bit).

For communication purpose, the macro uses three references, (VISA library, MS Comm Control6.0 (sp6), and MSComm32.ocx ), as shown below (original Window XP and Excel 2007 version):

Now we need to update the operation system to window 7 (which is 64 bit) and update MS Excel from Excel 2007 to Excel 2013(which is 64 bit too). When open the original macro file in the new window7 and MS Excel 2013 version, three references are gone, shown as below:

Here is what I have done:

1. Install “ni-visa_19.0_online” (which is NI visa for win7 version) for VISA Library. System visa library has been installed.

2. -- copy mscomm32.ocx (window7 version) to the directory C:\Windows\System32

    -- copy mscomm32.ocx (window7 version) to C:\Windows\SysWOW64

    -- type in “regsvr32 mscomm32.ocx” in the command window to register mscomm32.ocx
       system shows that mscomm32.ocx has been successfully registered.

3. Download “NETComm.ocx” for window 7 and install it.

 

After these three steps, the win7 and excel 2013 does not complain the reference missing, shown in the following image:

However, when I run the macro in win7 using excel 2013, it complains that the parameter “VI_FIND_BUFLEN” is not defined. Please see the following image.

Obviously, this parameter is defined in VISA head file in the directory: C:\Program Files\IVI Foundation\VISA\Win64\Include, this parameter is defined to be 256.

 

Now the problem points to that the visa library is not property included, which causes the right head file for 64 bit operation system is not included.

In order to include the 64 bit VISA header file, what .dll file should be referenced?

0 Kudos
Message 1 of 8
(3,036 Views)

Are you sure that your Office is 64-bit?

It is more common for it to be 32-bit.

I just upgraded to Windows 10 from Windows 7, and I can see in the logs information about upgrading Office 2010 32-bit.

0 Kudos
Message 2 of 8
(3,004 Views)

Thank you, as you said, I confirm that my MS excel is 32bit, not 64 bit.

0 Kudos
Message 3 of 8
(3,000 Views)

I am working on PC running Windows 7 Pro 64-bit.

 

visa.h is located in C:\Program Files (x86)\IVI Foundation\VISA\WinNT\Include

 

This PC is running NI-VISA 15.0.1

 

0 Kudos
Message 4 of 8
(2,970 Views)

Hi, psuedonym,

 

Yes, you are right. I can find the visa.h file in the directory manually.

 

However, the parameters defined in the visa.h file and constants defined in the visa.h file can not be used or called for some reason.

when the parameter value is called in program, the system said that parameter is not assigned value.

 

This is a weird problem. I dont think I run into a unique problem, but it was not reported anywhere else. The problem seems like the system does not inlcude the header file or recoganice the header file for some reason.

 

Is there a way to manually include this header file in the Excel VBA system?

 

0 Kudos
Message 5 of 8
(2,961 Views)

Excel VBA is very similar to Visual Basic 6.

 

It has been a while since I programmed in Visual Basic 6.

As I recall, when installing VISA, you need to choose which languages you want to use it with. I suspect you need to re-install VISA again.

 

.

0 Kudos
Message 6 of 8
(2,938 Views)
I found master9991 had exactly the same problem a while ago. But the post did not confirm the solution. https://forums.ni.com/t5/Instrument-Control-GPIB-Serial/VI-FIND-BUFLEN/m-p/1822671/highlight/false#M...
0 Kudos
Message 7 of 8
(2,935 Views)
Thank you so much. I reinstall the NI-VISA 5.2 again, the problem is still there.
0 Kudos
Message 8 of 8
(2,934 Views)