Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Excel OLE Automation Server
Message
 
À
13/12/1999 07:07:31
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00302601
Message ID:
00302660
Vues:
33
This line of code brings up a topic that has always bugged me....

oLineGraph = CreateObject('Excel.Sheet')
If !File('EachLine.XLS')
MessageBox('File EACHLINE.XLS is not found!',16)
Return
EndIf
ThisForm.oLineGraph.WorkBooks.Open('EachLine.XLS')

IMHO, placing returns in the middle of code blocks can make for a lot of problems. Rather, I would suggest:

oLineGraph = CreateObject('Excel.Sheet')
If File('EachLine.XLS')
ThisForm.oLineGraph.WorkBooks.Open('EachLine.XLS')
Else
MessageBox('File EACHLINE.XLS is not found!',16)
Endif

Return

I wonder what other's think?????






>Hi there,
>
>First add a OLE Bound control in your form and following are the sample code to open an excel file. (assuming filename is "EACHLINE.XLS" and the OLE bound control name is "oLineGraph")
>
>
>oLineGraph = CreateObject('Excel.Sheet')
>If !File('EachLine.XLS')
>   MessageBox('File EACHLINE.XLS is not found!',16)
>   Return
>EndIf
>ThisForm.oLineGraph.WorkBooks.Open('EachLine.XLS')
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform