The button on the form has this code...
DO m.dir+'progs\gues_label.prg'
Then the program itself...(does some other stuff, then comes the Excel part)
Select labels
Set ORDER TO NAME
Go TOP
Count TO COUNT
If COUNT>0
m.newfile=m.dir+"data\labels.xls"
Wait Clear
oleApp = Createobject("Excel.Application")
oleApp.Workbooks.Add
oleApp.DisplayAlerts=.f.
oleapp.Sheets("Sheet3").Select
oleapp.ActiveWindow.SelectedSheets.Delete
oleapp.Sheets("Sheet2").Select
oleapp.ActiveWindow.SelectedSheets.Delete
Select labels
Set order to name
Go Top
m.rownbr=1
oleApp.cells(m.rownbr,1).Value="fname"
oleApp.cells(m.rownbr,2).Value="name"
m.rownbr=2
Do While !Eof()
Scatter Memvar Memo
oleApp.cells(m.rownbr,1).Value=m.fname
oleApp.cells(m.rownbr,2).Value=m.name
m.rownbr=m.rownbr+1
Select labels
If !Eof()
Skip 1
If !Eof()
Loop
Endif
Endif
Enddo
oleApp.ActiveWorkbook.SaveAs(m.newfile)
oleApp.Quit
oleApp.DisplayAlerts=.t.
Wait Clear
Else
Messagebox("Records do not exist for month selected, please reselect",16,'')
Endif