Link to home
Start Free TrialLog in
Avatar of meep_meep
meep_meep

asked on

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:

tmpSheet=GETOBJECT('','Excel.Sheet')
XLApp = tmpSheet.Application
XLapp.DisplayAlerts=.t.
XLApp.Visible=.t.
oTimeSheets = XLApp.Workbooks.Open("c:\Excel\EmptyTimeSheet.XLS")
XLSheet = oTimeSheets.ActiveSheet
XLSheet.Cells.Select
XLSheet.Cells.Copy
XLApp.Sheets.Add()
XLNewSheet = XLApp.ActiveSheet
XLNewSheet.Cells.Select
XLNewSheet.Paste
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".

Thanks
ASKER CERTIFIED SOLUTION
Avatar of rspahitz
rspahitz
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of Ejgil Hedegaard
Ejgil Hedegaard
Flag of Denmark image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of meep_meep
meep_meep

ASKER

Wow, thanks to both.