Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Best way to view an Excel worksheet?
Message
De
04/09/1997 15:51:33
 
 
À
03/09/1997 19:07:45
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00048405
Message ID:
00048574
Vues:
32
>What is the best way to view a spreadsheet? I'm currently using a "RUN" command followed by the file name but this displays the "Foxrun" command window (big black box).
>
>Is there another, more elegant way to do this?
>
>Thanks in advance

Following code is part of snippet (commandbutton.click), saving report output to Excel and opening it immediately:
select tmpReport9
nAnswer=messagebox("Open File in Excel Format Right Now?",4+32,oApp.msgtitle)
if nAnswer=6
cError=on("error")
if type("thisform.oExcelapp")<>"O"
thisform.excelcount=1
on error lErrorflag=.t.
thisform.oExcelapp=createobject("Excel.Application")
if lErrorflag=.t.
on error &cError.
=messagebox("Cannot Launch Excel!",0+16,oApp.msgtitle)
return
endif
thisform.oExcelapp.visible=.t.
thisform.oeWorkbook=thisform.oExcelapp.workbooks
if lErrorflag=.t.
on error &cError.
=messagebox("Cannot Open Excel Workbook!",0+16,oApp.msgtitle)
return
endif
else
thisform.excelcount=thisform.excelcount+1
endif
cFilename=sys(5)+sys(2003)+"\upts"+alltrim(str(thisform.excelcount))+".xls"
set safety off
copy to &cFilename. type xl5
set safety on
thisform.oeWorkbook.open(cFilename)
if lErrorflag=.t.
on error &cError.
=aerror(aErrorinfo)
=messagebox("Cannot Open Excel File! "+aErrorinfo[2]+chr(13)+aErrorinfo[3],0+16,oApp.msgtitle)
return
endif
return
endif
Edward Pikman
Independent Consultant
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform