LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Accessing compiled VI`s via VBA

Hi,
anybody out there who can give me some hint`s on how to use VBA code on compiled VI`s ?
Problem:
I can easily access a LabVIEW VI through (EXCEL) VBA routines if the LV development system is installed on the same PC where my EXCEL macro runs.These procedure is well documented in some books & courses. But how to manage this by having only the compiled executable of the VI and the LVruntime on the target machine without the development system ??
Any hint will be appreciated.
best regards
Markus
0 Kudos
Message 1 of 12
(4,280 Views)
> anybody out there who can give me some hint`s on how to use VBA code
> on compiled VI`s ?

A LV built EXE will have a unique CLSID, or a unique ActiveX class.
When run, it autoregisters itself, or you can use the regedit tools to
register it as part of an installation, etc.

Also be sure that the .ini file is set to have the ActiveX server
connection active, an then browse for the EXE as if it were any other.

Greg McKaskle
0 Kudos
Message 2 of 12
(4,280 Views)
Hi Greg,
thanks for your efforts but I think there are some more details I don`t know to get this running.
I`ve checked the ActiveX checkbox in the App.-builder settings and found an additional file (*.tlb) created on the system furthermore I`ve added a line to the *.ini file: server.ole.enebaled=true.
But finally my VBA macro fails at creating the pointer to the LabVIEW Application object.
Set lvapp=CreateObject("LabVIEW.Application")
and i receive a message "runtime error 429"
... any ideas??
thanks in advance
Markus
0 Kudos
Message 3 of 12
(4,280 Views)
If you use "LabVIEW.Application" you will open a reference to LabVIEW itself, not to your executable. In the Application Builder, on the same tab you have the ActiveX checkbox you also give a name to your ActiveX server, use this name instead of "LabVIEW" e.g.

Set lvapp=CreateObject("myapp.Application")


LabVIEW, C'est LabVIEW

0 Kudos
Message 4 of 12
(4,280 Views)
> I`ve checked the ActiveX checkbox in the App.-builder settings and
> found an additional file (*.tlb) created on the system furthermore
> I`ve added a line to the *.ini file: server.ole.enebaled=true.
> But finally my VBA macro fails at creating the pointer to the LabVIEW
> Application object.
> Set lvapp=CreateObject("LabVIEW.Application")
> and i receive a message "runtime error 429"
> .. any ideas??

On the page in the app builder, I think you are able to give your own
classname. Apparently you should not include a space in the name. When
the app is built, it will produce a tlb file which tells other apps
about your app's ActiveX interface. In the client app, lie VBA, you
would use the class name you entered instead o
f LabVIEW in the
CreateObject() call -- something like "yourAppClassName.Application".

Greg McKaskle
0 Kudos
Message 5 of 12
(4,280 Views)
Hi Greg & Jean-Pierre,
thanks for your hard thoughts about that problem, but even though all these settings you`ve suggested are correct the VBA-macro won`t run on the target machine :((.
So finally I think there is some elementary driver missing on that machine.
Had a similar problem with LV5.1 to get the monitor? and snap? functions running. The solution was that two *dll`s have not been installed correctly by the LV-runtime installer.
Mabe the guys from NI can give me some hints on that.
#
Thanks again
Markus
0 Kudos
Message 6 of 12
(4,280 Views)
What is your LV app doing?

If you are doing anything other than native functions, there may be other dll's that are required for those operations.

Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 7 of 12
(4,280 Views)
Hi Ben,
at the moment i only try to get these ActiveX stuff running on the target machine....
My (demo)app does only multiplying the input by 10 and forward the result to the output (boring, I know, but I would be happy if I could get only this running via AxtiveX, the rest will be adaptation work...)

Markus
0 Kudos
Message 8 of 12
(4,280 Views)
Hi MarkusM,

if you install an Active-X server you must register it. For LabVIEW you have to do the following things:

Copy Myapp.exe and myapp.tlb to the target machine.
Install the LabVIEW runtime on the machine.
Then run Myapp.exe once to register it.

Now you will be able to access your Active-X server from VBA (I asume that VBA and Visual Basic will work the same).

If you need the changes to the registry reply to this answer.

Waldemar
Waldemar

Using 7.1.1, 8.5.1, 8.6.1, 2009 on XP and RT
Don't forget to give Kudos to good answers and/or questions
0 Kudos
Message 9 of 12
(4,280 Views)
Hi Waldemar,
I think you are (like the other experts) close to the final solution.
Ten minutes ago i had a phone call with a NI support engineer. He suggested exactly what you said and furthermore to install the runtime-engine with admin rights on the target machine to allow the installer to get these ActiveX stuff registered , need to check this now with our IT-dpt.. I´m working with different machines and I do not have the same access-rights on all machines.
I`ll keep you all informed.....
regards
Markus
0 Kudos
Message 10 of 12
(4,062 Views)