RE: Copy Excel worksheet to another workbook

Author: Richard Kaye

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

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