Forum Discussion
Thanks Marsha! I'm looking for ways to do it using JavaScript in TestComplete.
Thank you
Abhi
If you look here
There's an example of javascript with Excel.Workbooks
The link I sent you above explains another object Excel.Worksheet, that has a Copy available. Take a look at those pages and see if you can work it out. If not, post what you tried and we will work it out with you.
- Adagio8 years agoFrequent Contributor
Hi Marsha
I'm already working with Excel files using the COM object. This page has nothing related to my query.
I'm trying fund a way to copy and rename a worksheet in a workbook using JavaScript.
Thank you
Abhi
- tristaanogre8 years agoEsteemed Contributor
As Marsha_R, there are any number of methods, properties, etc, in the Excel COM objects. There probably is a way to create a copy of a worksheet however, I'm not expert at using Excel COM (there may be others who are) so for me to come up with the JavaScript for you would mean I'd spend my work hours or personal time doing so.
So... what have you tried, if anything? The Excel COM objects are documented on Microsoft support forums so you may want to try googling your need and see if there is anything out there for you... what you are asking for is not a uniquely TestComplete thing since it's interacting with Excel... the same thing you could probably do in JavaScript via a web page or something.
Perhaps someone will post here what they've tried but it might be a good experience for you to see what's out there in forums more specifically dedicated to working with Excel via COM.
- tristaanogre8 years agoEsteemed Contributor
To prove my point, I took 5 minutes and found the following link by googling "copy sheet in workbook via COM". The code is in VB, but the concepts are the same and should be easily translatable to JavaScript.
https://msdn.microsoft.com/en-us/vba/excel-vba/articles/worksheet-copy-method-excel