Dear Folks,
Thanks to everyone who replied to my question about LabVIEW and Excel and
ActiveX (repeated below). I did some more testing and playing around with
it. It seemed that both the text worksheet and the Excel macro were opening
and running, but the macro was acting as if no worksheet was open and just
quitting. I was using the Excel auto_open function, in that a macro named
auto_open should run immediately when the spreadsheet that contains it is
opened. This worked from the explorer, but does not from a spreadsheet
opened via Active-X. So, I had another ActiveX call to actually trigger
that auto_open macro. One of LabVIEW's examples was for running a specific
macro via Active-X. I tried that and it works, so now I'm using that. This
has the disadvantage that now my program has to keep track of the macro
sheet name and macro name, but at this point I just want it to work.

One response I got from Richard Hill, with some vi's from Duane Cousino,
mentioned some differences between Excel 97 and XP. I think the real
solution might be that even though I open that text file in Excel, I need
to explicitly activate that sheet via ActiveX (only in the XP version, the
97 version did not require this), before calling the auto_open macro.
However, I have yet to try this.

Thanks again to all who responded.
Alvin

Alvin W. Moore Jr.
Measurement Systems Programmer
Research, Development, and Engineering
Corning Cable Systems
Hickory, NC






Previous Message
Dear Folks,
I have a LabVIEW app that writes report data out to disk as a tab-delimited
text file, then triggers an Excel macro. The excel macro is an auto-open
macro, so I have a vi which opens the macro.xla file, then an ActiveX call
from LV that tells Excel to run the auto-open macro. This has worked fine
in the past, for previous projects, but on a recent project (in which I
copied over the same vi's from the old project) I could not get it to work.
Now labview opens the text file in excel, opens the macro.xla file, then
instead of running the macro Excel just closes both files and nothing seems
to happen. I tried several different things with timing, thinking maybe the
text file wasn't completely open when the macro was triggered, or some
such, but to no avail. I put a pop-up message box in the macro at the
start, and that works, it pops up, but after I dismiss it I see the same
behavior.

This morning, I loaded my old app, and to my surprise it no longer worked
either. The only change in Excel is I recently upgraded to Office XP, so
now it is Excel 2002 vs maybe Excel 2000 before. I have had to fiddle with
the ActiveX calls before for changes in Excel, but I tried all the usual
fiddling (delete and redrop the invoke/property nodes, change the property
to something else and back again, recompile the vi) made no difference.
Does anyone else have any experience with this? I am really doing very
little with ActiveX, just having Excel open a text file, open a macro file,
and run the xlauto_open macro, then waiting until the number of open
worksheets goes to 0 so I can close Excel.

Thanks in advance,
Alvin

Alvin W. Moore Jr.
Measurement Systems Programmer
Research, Development, and Engineering
Corning Cable Systems
Hickory, NC


Reply via email to