Hi,
Just wondering if anyone has any suggestion (aside from vbscript).
Is there any way to check if an excel Tab exist before trying to create it?
XLAddSheet takes 2 parameters, the handle and the name.
if I blindly add the name, and the name of the tab exist, it will create a new sheet called "Sheet#" where # is the next number if you have tabs (sheet1, sheet2, sheet3 - in which case # would be 4).
It would defintely be beneficial if trying to add a sheet and the sheet exist, that it does nto add and just return an error code or something, then we can check the return result and decide what to do. and if it doesnt exist the name of the tab is added and the result is successful.
Any suggestion is appreciated.
Thanks,
Hoang
PS. I can go through VBScript, but if I can do it in one swoop through Macroscheduler I rather take that route.
XLAddSheet
Moderators: Dorian (MJT support), JRL
- Marcus Tettmar
- Site Admin
- Posts: 7393
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Right now I think you'd need to do it with VBScript.
The only other workaround I can think of would be to try to query or set a value from the sheet first using XLGetCell/XLSetCell and check for an error which you'd get if the sheet didn't already exist. And if so, use XLAddSheet to add it.
Haven't tried this .. just an idea.
The only other workaround I can think of would be to try to query or set a value from the sheet first using XLGetCell/XLSetCell and check for an error which you'd get if the sheet didn't already exist. And if so, use XLAddSheet to add it.
Haven't tried this .. just an idea.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?