Excel: Sheets.Add After:=Sheets(Sheets.Count)

Trying to dupplicate a WorkSheet by "Adding after" a worksheet tab within Excel.  The only way I succeeded was this way:

XLApp = tmpSheet.Application
oTimeSheets = XLApp.Workbooks.Open("c:\Excel\EmptyTimeSheet.XLS")
XLSheet = oTimeSheets.ActiveSheet
XLNewSheet = XLApp.ActiveSheet
XLApp.ActiveWindow.Zoom = 55

But this create a new Worksheet "Before" the origin tab.  ADD should be as follow:
Add(Before as Variant, After as Variant, Count as Variant, Type as Variant) as Object.  

Anybody can help me "translating" this into Foxpro code ?  I would need to add after 1 worksheet, name "NewTimeSheet".

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Something like this should let you add sheets AFTER:

    Sheets.Add , Sheets("Sheet2"), 2

This will add "2" sheets, Sheet5 and Sheet4, immediately after Sheet2

Make sure to include the "," immediately after the Add so it skips the "Before" portion

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ejgil HedegaardCommented:
To make a copy of the entire sheet, you don't need to make a new sheet, and then copy/paste content.
This makes a copy of the active sheet (with all formatting etc.) to a new sheet placed after NewTimeSheet. The copied sheet will be named NewTimeSheet (2), so best to change name, to whatever you like.

Sheets(ActiveSheet.Name).Copy After:=Sheets("NewTimeSheet")
ActiveSheet.Name = "New sheet name"

Open in new window

meep_meepAuthor Commented:
Wow, thanks to both.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.