Hi
After years of doing Automation by hand I finally am trying to use the serve object from OffAutomation Book
the following code does not work and I don't know why:
LOCAL oExcel, oRange, cRow
_VFP.DATATOCLIP(,,3)
oExcel=THISFORM.cusExcel1 && added the serve object to the form
oExcel.lOpenAsNeeded=.T.
WITH oExcel
.OpenServer()
IF NOT .IsServerOpen()
WAIT WINDOW "Couldn't open Excel."
RETURN .F.
ENDIF
.ShowServer() && for debugging
* Create a workbook
.NewDocument()
x1=.IsDocOpen() && returns FALSE <------------------------------------Why, I can see a sheet in excel!
* Check whether workbook is open
IF x1
WITH .oDocument.Sheets[1]
oRange=.RANGE("a1:z2")
oRange.SELECT()
.PASTE
ENDWITH
ENDIF
ENDWITH
oRange=""
oExcel=""
RETURN
Thanks
Peter
Peter Cortiel