Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

moving excel worksheet

COM and Automation

moving excel worksheet

by  danceman  Posted    (Edited  )
local obj, objsheet
obj = createobject('excel.application')
obj.application.workbooks.open('C:\My Documents\book3.xls')

** if you want to see what you are doing
obj.Application.visible = .t.


** if you don't know the sheet name use the index
* objsheet = obj.Application.Workbooks(1).Worksheets(1)
** if you know the work sheet name
objsheet = obj.Application.Workbooks(1).Worksheets('Sheet1')
objsheet is the sheet that the sheet being moved is being placed.

** move sheet 1 before sheet 3
*obj.Application.Workbooks(1).Worksheets('Sheet3').move(objsheet)

** move sheet 1 after sheet 4
*obj.Application.Workbooks(1).Worksheets('Sheet4').move(,objsheet)
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top