that worked perfectly, thanks Dorin
~M
>>hi all,
>>i am trying to add a new worksheet into an automation program using excel. everything works fine except that i need to add a sheet to the end. At the moment i have Sheet1, Sheet2, Sheet3 and if i add one more it becomes Sheet1, Sheet2, Sheet4, Sheet3 and so on. the excel help says add in a parameter move(after as varient) but i cannot get it to work.
>>OleApp.worksheets.Add
>>OleApp.Sheets(msheet).Select
>>OleApp.Sheets(msheet).Name = "Source"
>>any help much appreciated.
>
>
>OleApp.Worksheets.Add(.null.,OleApp.Worksheets.Item(3))
>
Go raibh maith agat
~M