Hi Daniel,
Thanks for the reply. I am not sure this will work for me as:
I do not know the range in advance
and I have 1 sheet that I will have to replicate n times
..which is why I was trying to use the
.Sheets("Page 01").Copy('After')=.Sheets(x)
which will do what I want, only I seem to be running into syntax problems...
>Ashley,
>The following code may give you some ideas. It copies the first worksheet 10 times. Each copy is copied after the last worksheet.
>
>
>oXls=CREATEOBJECT("excel.application")
>oXLS.Application.Workbooks.Add()
>
>oXls.visible=.t.
>oSheetToCopy = oXls.Worksheets("sheet1")
>oSheetToCopy.Range("A1").value = "Test"
>
>lnWorksheets = oXls.Worksheets.count
>
>FOR i = 1 TO 10
> oSheetToCopy.copy(,oXls.Worksheets(lnWorksheets))
> lnWorksheets = lnWorksheets + 1
> oXls.Worksheets(lnWorksheets).name = "sheet"+ALLTRIM(STR(lnWorksheets))
>ENDFOR
>
>HTH
>>Hi,
>>
>>I'm having trouble trying to copy a worksheet to another new one...
>>I'm using:
>>.Sheets("Page 01").Copy('After')=.Sheets(x) (where x is part of a loop to replicate the sheet as many times as required)
>>
>>Excel does not like the 'After'. I've tried sending it as a string, Boolean, Numeric without success.
>>Can someone point me in the right direction?
>>
>>TIA