From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
04-13-2009 02:24 PM
I currently have several hundred excel files which each have 3 sheets. Some of the files have been saved with the first sheet open, some with the second sheet open, and some with the third sheet open. When one of these files is opened it automatically opens to the sheet that was displayed when it was saved last.
I need to write a LabVIEW program that opens each of these files, does some formatting, makes sure cell A1 is selected in each sheet, and make sure the first sheet is open when it is saved, so it opens with the first sheet showing. I'm new to ActiveX, but I've already figured out the formatting, and I'm doing formatting in all 3 sheets. I just can't figure out how to choose which cell is selected and which sheet is displayed.
Thanks for the help, Jeremy |
Solved! Go to Solution.
04-13-2009 04:33 PM - edited 04-13-2009 04:34 PM
Try the attached VI. It was adapted from:
http://zone.ni.com/devzone/cda/epd/p/id/60
I had to change the cell contents of the desired sheet to keep that sheet on top when saved. You probably could just change an attribute (font size, etc.) if changing the cell contents is undesirable.
Note: the selected sheet name on the front panel is the sheet that will be on top when opened.
04-13-2009 04:41 PM
04-14-2009 05:52 AM
I don't think your advice would be to open each sheet and run the macro if you had several hundred sheets to open from several hundred folders . Through LabVIEW I can automatically open every sheet from all the different folders. One button and they all get changed. Plus, I'll be doing this on a regular basis, so the easier the better.
04-14-2009 06:52 AM - edited 04-14-2009 06:54 AM
Jeremy
You can get the worksheet names and then get a reference to the selected worksheet .
04-14-2009 07:44 AM
Thanks for the help everyone! With a little work on Excel.vi from VT92 I was able to get what I needed.
04-14-2009 07:57 AM - edited 04-14-2009 07:58 AM
JMBacker wrote:I don't think your advice would be to open each sheet and run the macro if you had several hundred sheets to open from several hundred folders . Through LabVIEW I can automatically open every sheet from all the different folders. One button and they all get changed. Plus, I'll be doing this on a regular basis, so the easier the better.
Actually, I would! You could open and run the macro on each one in about 5 seconds per file. I could be done 100 in less then 5 minutes. Nothing was said about several hundred folders, just several hundred sheets. If I found that was too many too do, then I would program a loop in my Excel VB macro to handle them all which would only take another 10 minutes to program.
While I find LabVIEW is more fun to program with, if there is a better tool that makes more sense to use for a particular situation, such as using Excel to handle Excel spreadsheets, then I would use that.