07-11-2012
03:42 AM
- last edited on
07-11-2012
08:58 AM
by
MaryH
Hi all,
i would like to fully interact with an Excel macro through LabVIEW. In particular, i would like to:
1 - Get the value of an excel indicator
2 - Set the value of an excel control
3 - Click on an excel button
4 - Intercept and close an excel popup message
In order to reach this goal, i developed a simple excel macro ("SimpleMacro.xls"), with which is possible, by clicking on a specific button, both to write text to file and to read text from file. After completing any of the above operations, a popup message is shown. You can find the macro in the attached archive.
In the same archive you can find a VI which realizes the following operations:
1 - opens excel
2 - opens the workbook
3 - waits
4 - closes the workbook
5 - closes excel
What remains is to implement the code to write to file and to read from file interacting with Excel.
I will appreciate any suggestions which give me the possibility to complete these actions.
Thanks!!
07-11-2012 04:03 AM
You can achive this by two way.
1. Using activeX control
2. Using report generation toolkit.
Also you will get ready example in LabVIEW Help.
07-11-2012 04:28 AM - edited 07-11-2012 04:32 AM
Tha attached VI already uses ActiveX.
What i need is an help to complete the "WriteToFile" and "ReadFromFile" actions, using correct ActiveX properties and methods.
LavbVIEW examples don't seem to be exhaustive.
Marco
07-11-2012 07:49 AM
To be honest, I don't understand what you are asking for. Are you asking for help on how to write the macro? Are you asking for help on how to run a macro in an Excel workbook using ActiveX? Are you asking how to do what the macro does, but in LabVIEW?
07-11-2012 08:03 AM
The macro was realized by me and is an example. It contains controls, indicators, buttons and, after a writing or reading action, it displays popup messages.
With LabVIEW i would like to do what the macro does: nothing more, nothing less.
07-11-2012 08:05 AM
But you said you want to do the file reading/writing using ActiveX, which makes zero sense to me. Just use the LabVIEW file functions.
07-11-2012 08:30 AM
Don't focus on what the macro does (i.e. write to or read from file). I create the "SimpleMacro.xls" file just to have an Excel workbook with at least two sheets and with some controls, indicators, buttons and popup messges with which to interact.
With this post i would like (with the aid of the forum) to create a sort of guide!
07-11-2012 08:34 AM
@aRCo wrote:
Don't focus on what the macro does (i.e. write to or read from file). I create the "SimpleMacro.xls" file just to have an Excel workbook with at least two sheets and with some controls, indicators, buttons and popup messges with which to interact.
With this post i would like (with the aid of the forum) to create a sort of guide!
No need for a guide. There are examples included with LabVIEW for how to control Excel via ActiveX.
07-11-2012 09:01 AM
You seem to be quite sure about the exhaustiveness of the examples. So you should be able to show me how to modifiy the value of the "Path" string control in the "WriteToFile" sheet contained in the attached "SimpleMacro.xls" file.
Thanks in advance!!
07-11-2012 09:26 AM - edited 07-11-2012 09:31 AM
@aRCo wrote:
You seem to be quite sure about the exhaustiveness of the examples. So you should be able to show me how to modifiy the value of the "Path" string control in the "WriteToFile" sheet contained in the attached "SimpleMacro.xls" file.
Thanks in advance!!
You don't know how to modify a path control?
Unless your VI is 8.6, I can't view it.
By the way, if you are going to control Excel with ActiveX, it is generally redundant to use macros since macros are VBA code which the LabVIEW code is replacing.