Sign in to follow this  
Followers 0
niassa

Excel Worksheets check

7 posts in this topic

Hi all, I've been wracking my brain, and I'm sure this is pretty easy and I'm just missing it somehow *paranoid look* but I'm trying to write a script to check to see if a worksheet exists in my excel object and if it does to select it and if it doesn't to create it. For whatever reason my fried brain is having issues with this... *hides under a couch* :whistle: Any thoughts?

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Have a look. Here should be something you need.

Edited by BugFix

Best Regards BugFix  

Share this post


Link to post
Share on other sites

Yeah, I checked that and have pored over Locodarwin's as well and I still can't figure it out. *sigh* Pardon me while I go beat my head for awhile. Thank you for your response, though. :whistle:

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

If you're using my collection of functions:

1. Use $array = _ExcelSheetList($object) to return the list of sheets in the object to an array.

2. Search the array for the sheet name you're looking for.

3. If the sheet is listed in the array, use _ExcelSheetActivate($object, "sheetname") to activate it.

4. If the sheet is not listed in the array, use _ExcelSheetAddNew($object, "sheetname") to create and activate a new sheet with that name.

That's all there is to it, really.

-S

Edited by Locodarwin

(Yet Another) ExcelCOM UDF"A human being should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly...[indent]...specialization is for insects." - R. A. Heinlein[/indent]

Share this post


Link to post
Share on other sites

Thank you so much, Locodarwin. :whistle:

I guess at this point what I'm a bit confused on is how to search the array. I'm still quite a newbie to all of this. I feel blessed that I've done as well as I have... and then to get stuck at this spot just makes me want to rip out my hair. LOL! I so appreciate your help, though! :)

Share this post


Link to post
Share on other sites

Oh yeah, and I should mention that the one thing I seem to have consistent issues with, with regards to understanding, is arrays. I don't know why I have such a difficult time grasping it, but for whatever reason I do. *insert yet another paranoid look*

Share this post


Link to post
Share on other sites

No worries. I've sent you a PM with additional help. Good luck with your Excel endeavors!

-S


(Yet Another) ExcelCOM UDF"A human being should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly...[indent]...specialization is for insects." - R. A. Heinlein[/indent]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0