LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Fully interact with an Excel macro through LabVIEW

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!!

0 Kudos
Message 1 of 23
(4,570 Views)

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.

 

 

Regards
Prabhakant Patil
0 Kudos
Message 2 of 23
(4,567 Views)

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

0 Kudos
Message 3 of 23
(4,562 Views)

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?

0 Kudos
Message 4 of 23
(4,534 Views)

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.

0 Kudos
Message 5 of 23
(4,529 Views)

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.

0 Kudos
Message 6 of 23
(4,527 Views)

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!

0 Kudos
Message 7 of 23
(4,523 Views)

@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.

 

0 Kudos
Message 8 of 23
(4,520 Views)

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!!

0 Kudos
Message 9 of 23
(4,506 Views)

@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.

 

 

0 Kudos
Message 10 of 23
(4,498 Views)