Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Copying from one worksheet to another with VFP
Message
 
À
20/05/2003 09:11:59
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00790369
Message ID:
00790409
Vues:
23
>Not quite working Bruce.
>From the macro I receive this code:
>
> Range("A1:AG3453").Select
> Selection.Copy
> Windows("test.xls").Activate
> Sheets("FILE2").Select
> Range("C1").Select
> ActiveSheet.Paste
>
>How does this translate to VFP? I have tried to add "oexcel." to each command here but I still get the invalid index error

That looks like the right method, using Copy/Paste. I added a line of VBA at a time, and got this to work on two small test files:

oexcel = CREATEOBJECT("Excel.Application")
oexcel.visible = .t.
file1 = FULLPATH('file1.xls')
oexcel.workbooks.OPEN(file1)
oexcel.Range("A1:AG3453").Select
oexcel.Selection.Copy
file2 = FULLPATH('file2.xls')
oexcel.workbooks.OPEN(file2)
oexcel.Activesheet.Paste
The Anonymous Bureaucrat,
and frankly, quite content not to be
a member of either major US political party.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform