niassa Posted February 16, 2007 Share Posted February 16, 2007 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* Any thoughts? Link to comment Share on other sites More sharing options...
BugFix Posted February 16, 2007 Share Posted February 16, 2007 (edited) Have a look. Here should be something you need. Edited February 16, 2007 by BugFix Best Regards BugFix Link to comment Share on other sites More sharing options...
niassa Posted February 16, 2007 Author Share Posted February 16, 2007 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. Link to comment Share on other sites More sharing options...
Locodarwin Posted February 16, 2007 Share Posted February 16, 2007 (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 February 16, 2007 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] Link to comment Share on other sites More sharing options...
niassa Posted February 16, 2007 Author Share Posted February 16, 2007 Thank you so much, Locodarwin. 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! Link to comment Share on other sites More sharing options...
niassa Posted February 16, 2007 Author Share Posted February 16, 2007 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* Link to comment Share on other sites More sharing options...
Locodarwin Posted February 16, 2007 Share Posted February 16, 2007 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] Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now