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.