Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Excel Syntax - copying one worksheet to another new one
Message
From
13/06/2001 17:21:20
 
 
To
12/06/2001 10:44:22
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00518215
Message ID:
00519082
Views:
13
Thanks for your helpful replies Tamar & Daniel,

Feel like I'm getting closer, but... I think I'm missing something here..
I am assuming that, as in the test macro I created to do this in Excel, the new sheet(s) would be also created as part of the copy.

Using your example, Tamar, I also added the optional Count parameter to create nPages -1 copies of Page 1. Now I get a syntax error at that line...
with oExcel
.WorkBooks.Open(cXLSfile)
.visible=.t.
.DisplayAlerts=.F.
cFooter='Created on '+left(cdow(date()),3)+', '+left(cmonth;
(date)),3)+' '+right(dtos(date()),2)+', '+;
left(dtos(date()),4)+' at '+left(time(),5)
.Sheets("Page 01").Select
.ActiveSheet.Cells.SpecialCells(11).Activate
nMaxExcelRows=.ActiveCell.Row
nMaxExcelColumns=.ActiveCell.Column
.Cells(1,1).Activate
nPages=int(nLineCounter/nMaxExcelRows)+5

***********************************************
.Sheets("Page 01").Copy(,.Sheets[1],nPages-1)
***********************************************
&&..some more processing
endwith

Any further suggestions would be appreciated

TIA





>The issue is that the Copy method expects one of two parameters in this case: either the sheet to put the new sheet before or the sheet to put it after. That is, the syntax for copying a whole sheet is:
>
>oSheetToCopy.Copy( oSheetBefore , oSheetAfter )
>
>with the limitation that you specify either oSheetBefore or oSheetAfter, but not both. So the correct syntax for the command you're trying is:
>
>.Sheets["Page 01"].Copy(, .Sheets[x])
>
>Hope this helps.
>
>Tamar
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform