Index
2017-02-16 10:48Paul Newton : Copy Excel worksheet to another workbook
2017-02-16 11:09Peter Cushing : Re: Copy Excel worksheet to another workbook
2017-02-16 11:12Jan Bucek : Re: Copy Excel worksheet to another workbook
2017-02-16 11:36Richard Kaye : RE: Copy Excel worksheet to another workbook
2017-02-16 12:03Richard Kaye : RE: Copy Excel worksheet to another workbook
2017-02-16 12:26Kurt Wendt : RE: Copy Excel worksheet to another workbook
2017-02-16 12:34Richard Kaye : RE: Copy Excel worksheet to another workbook
2017-02-16 12:56Kurt at VR-FX : Re: Copy Excel worksheet to another workbook
2017-02-17 02:24Paul Newton : RE: Copy Excel worksheet to another workbook
2017-02-17 02:25Paul Newton : RE: Copy Excel worksheet to another workbook
Back to top
Copy Excel worksheet to another workbook

Author: Paul Newton

Posted: 2017-02-16 10:48:17   Link

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?)

Any help would be much appreciated

Paul Newton

_______________________________________________

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/9A8106AFB0EF9B44B69045C4448935A201510E94E1@NLBAWEXMBX1.infor.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 Paul Newton
Back to top
Re: Copy Excel worksheet to another workbook

Author: Peter Cushing

Posted: 2017-02-16 11:09:21   Link

On 16/02/2017 16:48, Paul Newton wrote:

> 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?)

>

>

I've had fun with this in the past. I found a way that works by only

having one workbook open at a time. You open the one you want to copy

into first. Then open the one to copy from, select the data and copy,

then close it, then paste into the other one.

Here's some chopped up code. Think I had to tinker with it to get it to

work with office 2013 but this is the general idea. I couldn't get it

to work with both workbooks open. I'm sure it can be done but...

* start automation and open file etc.

objexcel.Workbooks.add

objexcel.sheets.add

* open sheet and paste onto here.

objexcel.workbooks.open(filetocopyfrom)

objexcel.range("A2").select

* select full area

objexcel.Range("a1").CurrentRegion.Select

objexcel.selection.copy

* now close this so it should select the first one.

objexcel.ActiveWorkbook.Close

* need to select first book to paste into

objexcel.workbooks(1).activate

objexcel.range("A1").select

* and paste in

objexcel.ActiveSheet.paste

* add new tab for next one etc..

This communication is intended for the person or organisation to whom it is addressed. The contents are confidential and may be protected in law. Unauthorised use, copying or disclosure of any of it may be unlawful. If you have received this message in error, please notify us immediately by telephone or email.

www.whisperingsmith.com

Whispering Smith Ltd Head Office:61 Great Ducie Street, Manchester M3 1RR.

Tel:0161 831 3700

Fax:0161 831 3715

London Office:17-19 Foley Street, London W1W 6DW Tel:0207 299 7960

_______________________________________________

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/ec07c0eb-c0c8-cd64-9513-73249c170fbf@whisperingsmith.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 Peter Cushing
Back to top
Re: Copy Excel worksheet to another workbook

Author: Jan Bucek

Posted: 2017-02-16 11:12:22   Link

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/640497e0-79e6-6c97-b746-170b1cad22d7@post.cz

** 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 Jan Bucek
Back to top
RE: Copy Excel worksheet to another workbook

Author: Richard Kaye

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

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
Back to top
RE: Copy Excel worksheet to another workbook

Author: Richard Kaye

Posted: 2017-02-16 12:03:40   Link

Clearly I'm avoiding doing anything productive right now.

**************************************

* Program: FunWithExcel1.prg

* Date: 02/16/2017 12:46

* VFP Version: Visual FoxPro 09.00.0000.7423 for Windows

* Notes: open a workbook, copies the 2nd sheet before the current 2nd sheet, makes another copy after the 3rd sheet

**************************************

ACTIVATE SCREEN

CLEAR

LOCAL m.ox AS Excel.Application, m.ow AS Excel.Workbook, m.oss AS Excel.Worksheet

m.ox=CREATEOBJECT([excel.application])

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

m.ow=m.ox.ActiveWorkbook

?m.ow.Sheets.Count

m.oss=ow.Sheets(2) && this example has 2 sheets. get a ref to the 2nd sheet

m.oss.copy(ow.Sheets(2)) && copy it before the 2nd sheet

?m.ow.Sheets.Count

m.oss.copy(,ow.Sheets(3)) && copy it after the 3rd sheet

?m.ow.Sheets.Count

m.ox.Visible=.t.

--

rk

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

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

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

To: profoxtech@leafe.com

Subject: RE: Copy Excel worksheet to another workbook

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/BN4PR10MB0913BE883591E8E7C41F26BDD25A0@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
Back to top
RE: Copy Excel worksheet to another workbook

Author: Kurt Wendt

Posted: 2017-02-16 12:26:20   Link

Hey rk - Great program name!!! Gosh - U must be bored - and its not even a Friday... :-)

Regards,

Kurt Wendt

Senior Systems Analyst

Tel. +1-212-747-9100

www.GlobeTax.com

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

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

Sent: Thursday, February 16, 2017 1:04 PM

To: profoxtech@leafe.com

Subject: RE: Copy Excel worksheet to another workbook

Clearly I'm avoiding doing anything productive right now.

**************************************

* Program: FunWithExcel1.prg

* Date: 02/16/2017 12:46

* VFP Version: Visual FoxPro 09.00.0000.7423 for Windows

* Notes: open a workbook, copies the 2nd sheet before the current 2nd sheet, makes another copy after the 3rd sheet

**************************************

ACTIVATE SCREEN

CLEAR

LOCAL m.ox AS Excel.Application, m.ow AS Excel.Workbook, m.oss AS Excel.Worksheet

m.ox=CREATEOBJECT([excel.application])

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

m.ow=m.ox.ActiveWorkbook

?m.ow.Sheets.Count

m.oss=ow.Sheets(2) && this example has 2 sheets. get a ref to the 2nd sheet

m.oss.copy(ow.Sheets(2)) && copy it before the 2nd sheet

?m.ow.Sheets.Count

m.oss.copy(,ow.Sheets(3)) && copy it after the 3rd sheet

?m.ow.Sheets.Count

m.ox.Visible=.t.

--

rk

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

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

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

To: profoxtech@leafe.com

Subject: RE: Copy Excel worksheet to another workbook

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/80838F1CA795B14EA1AF48659F35166F18FD71F8@DREXCH02.corp.globetax.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 Kurt Wendt
Back to top
RE: Copy Excel worksheet to another workbook

Author: Richard Kaye

Posted: 2017-02-16 12:34:45   Link

It's not boredom; it's avoidance of real work. :-)

--

rk

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

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

Sent: Thursday, February 16, 2017 1:26 PM

To: profoxtech@leafe.com

Subject: RE: Copy Excel worksheet to another workbook

Hey rk - Great program name!!! Gosh - U must be bored - and its not even a Friday... :-)

Regards,

Kurt Wendt

Senior Systems Analyst

Tel. +1-212-747-9100

www.GlobeTax.com

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

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

Sent: Thursday, February 16, 2017 1:04 PM

To: profoxtech@leafe.com

Subject: RE: Copy Excel worksheet to another workbook

Clearly I'm avoiding doing anything productive right now.

**************************************

* Program: FunWithExcel1.prg

* Date: 02/16/2017 12:46

* VFP Version: Visual FoxPro 09.00.0000.7423 for Windows

* Notes: open a workbook, copies the 2nd sheet before the current 2nd sheet, makes another copy after the 3rd sheet

**************************************

ACTIVATE SCREEN

CLEAR

LOCAL m.ox AS Excel.Application, m.ow AS Excel.Workbook, m.oss AS Excel.Worksheet

m.ox=CREATEOBJECT([excel.application])

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

m.ow=m.ox.ActiveWorkbook

?m.ow.Sheets.Count

m.oss=ow.Sheets(2) && this example has 2 sheets. get a ref to the 2nd sheet

m.oss.copy(ow.Sheets(2)) && copy it before the 2nd sheet

?m.ow.Sheets.Count

m.oss.copy(,ow.Sheets(3)) && copy it after the 3rd sheet

?m.ow.Sheets.Count

m.ox.Visible=.t.

_______________________________________________

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/BN4PR10MB0913CCE19049D2CC61FF4A0BD25A0@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
Back to top
Re: Copy Excel worksheet to another workbook

Author: Kurt at VR-FX

Posted: 2017-02-16 12:56:28   Link

Ha ha - I totally hear you! Gotta admit - I'm doing a bit of the same

thing today!!!

;-)

-K-

On 2/16/2017 1:34 PM, Richard Kaye wrote:

> It's not boredom; it's avoidance of real work. :-)

>

> --

>

> rk

> -----Original Message-----

> From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Kurt Wendt

> Sent: Thursday, February 16, 2017 1:26 PM

> To: profoxtech@leafe.com

> Subject: RE: Copy Excel worksheet to another workbook

>

> Hey rk - Great program name!!! Gosh - U must be bored - and its not even a Friday... :-)

>

> Regards,

> Kurt Wendt

> Senior Systems Analyst

>

>

> Tel. +1-212-747-9100

> www.GlobeTax.com

>

> -----Original Message-----

> From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Richard Kaye

> Sent: Thursday, February 16, 2017 1:04 PM

> To: profoxtech@leafe.com

> Subject: RE: Copy Excel worksheet to another workbook

>

> Clearly I'm avoiding doing anything productive right now.

>

> **************************************

> * Program: FunWithExcel1.prg

> * Date: 02/16/2017 12:46

> * VFP Version: Visual FoxPro 09.00.0000.7423 for Windows

> * Notes: open a workbook, copies the 2nd sheet before the current 2nd sheet, makes another copy after the 3rd sheet

> **************************************

> ACTIVATE SCREEN

> CLEAR

> LOCAL m.ox AS Excel.Application, m.ow AS Excel.Workbook, m.oss AS Excel.Worksheet

> m.ox=CREATEOBJECT([excel.application])

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

> m.ow=m.ox.ActiveWorkbook

> ?m.ow.Sheets.Count

> m.oss=ow.Sheets(2) && this example has 2 sheets. get a ref to the 2nd sheet

> m.oss.copy(ow.Sheets(2)) && copy it before the 2nd sheet

> ?m.ow.Sheets.Count

> m.oss.copy(,ow.Sheets(3)) && copy it after the 3rd sheet

> ?m.ow.Sheets.Count

> m.ox.Visible=.t.

>

>

>

[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/d43d989b-fa74-b8cb-57a7-0bbb8e606466@optonline.net

** 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 Kurt at VR-FX
Back to top
RE: Copy Excel worksheet to another workbook

Author: Paul Newton

Posted: 2017-02-17 02:24:44   Link

Thanks Peter - I'll play around with that

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

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

Sent: 16 February 2017 17:09

To: profoxtech@leafe.com

Subject: Re: Copy Excel worksheet to another workbook

On 16/02/2017 16:48, Paul Newton wrote:

> 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?)

>

>

I've had fun with this in the past. I found a way that works by only having one workbook open at a time. You open the one you want to copy into first. Then open the one to copy from, select the data and copy, then close it, then paste into the other one.

Here's some chopped up code. Think I had to tinker with it to get it to work with office 2013 but this is the general idea. I couldn't get it to work with both workbooks open. I'm sure it can be done but...

* start automation and open file etc.

objexcel.Workbooks.add

objexcel.sheets.add

* open sheet and paste onto here.

objexcel.workbooks.open(filetocopyfrom)

objexcel.range("A2").select

* select full area

objexcel.Range("a1").CurrentRegion.Select

objexcel.selection.copy

* now close this so it should select the first one.

objexcel.ActiveWorkbook.Close

* need to select first book to paste into objexcel.workbooks(1).activate objexcel.range("A1").select

* and paste in

objexcel.ActiveSheet.paste

* add new tab for next one etc..

This communication is intended for the person or organisation to whom it is addressed. The contents are confidential and may be protected in law. Unauthorised use, copying or disclosure of any of it may be unlawful. If you have received this message in error, please notify us immediately by telephone or email.

www.whisperingsmith.com

Whispering Smith Ltd Head Office:61 Great Ducie Street, Manchester M3 1RR.

Tel:0161 831 3700

Fax:0161 831 3715

London Office:17-19 Foley Street, London W1W 6DW Tel:0207 299 7960

[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/9A8106AFB0EF9B44B69045C4448935A201510E95A0@NLBAWEXMBX1.infor.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 Paul Newton
Back to top
RE: Copy Excel worksheet to another workbook

Author: Paul Newton

Posted: 2017-02-17 02:25:17   Link

Thanks Richard - I'll try that too

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

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

Sent: 16 February 2017 17:36

To: profoxtech@leafe.com

Subject: RE: Copy Excel worksheet to another workbook

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/9A8106AFB0EF9B44B69045C4448935A201510E95B9@NLBAWEXMBX1.infor.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 Paul Newton