RE: Copy Excel worksheet to another workbook

Author: Richard Kaye

Posted: 2017-02-16 at 11:36:13

ox=CREATEOBJECT([excel.application])

ox.Visible=.t.

ox.Workbooks.Open(GETFILE([xlsx]))

ow=ox.ActiveWorkbook

ow.SaveCopyAs([c:\rfc\copytest.xlsx])

ox.Workbooks.Open([c:\rfc\copytest.xlsx])

This copies the entire document, not an individual sheet.

--

rk

-----Original Message-----

From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Jan Bucek

Sent: Thursday, February 16, 2017 12:12 PM

To: profoxtech@leafe.com

Subject: Re: Copy Excel worksheet to another workbook

Dne 16.2.2017 v 17:48 Paul Newton napsal(a):

> Hi all

>

> I want to use automation to copy the active worksheet into another workbook (as an additional worksheet)

> I believe I need something like this

> ActiveSheet.Copy After:=Workbooks("YourWorkbookName.xls"). Sheets("Sheet3")

> But I can't find how to send the correct way to do it in VFP

>

> o = CreateObject("Excel.Application")

> o.Visible = .t.

> o.Workbooks.Open("C:\O32\OperaNext\Opera32\DEMODATA\SQSLACL.XLS")

> o.ActiveSheet.Copy(What to put here?)

And what about a little different way?

1. select all

2. copy

3. open another workbook

4. paste

>

> Any help would be much appreciated

>

> Paul Newton

>

>

[excessive quoting removed by server]

_______________________________________________

Post Messages to: ProFox@leafe.com

Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox

OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech

Searchable Archive: http://leafe.com/archives/search/profox

This message: http://leafe.com/archives/byMID/profox/BN4PR10MB09133B7342236ABBAB23354CD25A0@BN4PR10MB0913.namprd10.prod.outlook.com

** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

©2017 Richard Kaye