> goingtothetop
>
> I am using the code below - different cursors - to copy data from Foxpro to an excel sheet- different columns.
>
> Problem is... I have to click on Save changes... every time I paste and close the workbook.
>
> If I say oExcelObject...Save or SaveAs... it requires overwriting of the main document... which is not required.
>
> Is there a better way forward ?
>
> SELECT Y1Lot
> _VFP.DataToClip()
>
> WITH oExcelObject.Worksheets("Valuations")
> oExcelObject.ActiveSheet.range("A5").select && Paste the Data
> oExcelObject.ActiveSheet.Paste() && Paste the Data
> oExcelWorkbook.close
> ENDWITH
>
> SELECT Y1Valu
> _VFP.DataToClip()
>
> oExcelWorkbook = oExcelObject.Application.Workbooks.Open(cSheet)
>
> WITH oExcelObject.Worksheets("Valuations")
> oExcelObject.ActiveSheet.range("B5").select && Paste the Data
> oExcelObject.ActiveSheet.Paste() && Paste the Data
> oExcelWorkbook.close
> ENDWITH
As a side coment, may I point out that you're using the WITH - ENDWITH the wrong way.
WITH oExcelObject.ActiveSheet && or With oExcelObject.Workbook or WITH oExcelObject.ActiveWorkBook
.Range ('A5')
.Paste()
oExcelWorkbook.Close
ENDWITH
looks better to me if oExcelObject refers to the Excel Application object. ActiveSheet is an object property of WorkBook.
The point of a WITH block is not to have to repeat the object reference explicitely.
-Anders