Add New Worksheet at the End
SOLVED- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-29-2015
07:59 AM
12-29-2015
07:59 AM
Add New Worksheet at the End
Hi,
I'm trying to add a new worksheet at the end of the workbook. The following add method adds the worksheet at the first sheet. VBA After:= with count is not working in test complete.
sWritePath="Z:\Expected Data Report Files\ComSnapShot\Sample.xlsx"
Set oXL = CreateObject("Excel.Application")
Set oVPRWB = oXL.Workbooks.Open(sMainpath)
Set oPCSExpWB= oXL.Workbooks.Open(sWritePath)
oPCSExpWB.Worksheets.Add
Appreciate any idea to add the new sheet at the end.
Regards,
Sudhakar
Solved! Go to Solution.
4 REPLIES 4
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-04-2016
02:37 AM
01-04-2016
02:37 AM
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2016
03:56 AM
01-05-2016
03:56 AM
Hi Sudhakar,
The following code works for me:
sub Test1 sWritePath="e:\Book1.xlsx" Set oXL = CreateObject("Excel.Application") Set oPCSExpWB= oXL.Workbooks.Open(sWritePath) Call oPCSExpWB.Worksheets.Add (, oPCSExpWB.Sheets(oPCSExpWB.Sheets.Count)) oPCSExpWB.Save oXL.Quit end sub
---------
Tanya Yatskovskaya
SmartBear Community and Education Manager
Tanya Yatskovskaya
SmartBear Community and Education Manager
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-07-2016
01:21 AM
01-07-2016
01:21 AM
Hi:
This code works. Appreciate it
Thanks,
Sudhakar
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-07-2016
01:24 AM
01-07-2016
01:24 AM
Thats pretty much identical to what it says on the Stack post I linked to ....
