Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Excell from within an exe
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00058190
Message ID:
00058887
Vues:
38
>>>Look at the help in VFP about CREATEOBJECT(). It actually shows you how to
>>>create an instance of excel. Once you have the object reference to excel,
>>>you can do anything you want with it.
>>
>>One thing I couldn't find: how do I run an excel macro? Can't figure out
>>the hierarchy, syntax or whatever is necessary.
>>(VFP 5.0 and Office 97)
>
>You could record the macro and edit/copy the code into your VFP application and do all the commands through OLE.
>
>
>Wayne

To complement and support your point, Wayne, i found that, as long as your Excel Activity is not too VBA-intensive, keeping the control of EXCEL from VFP is a very good solution (that is what i do).

Contrary to Word 97 where controlling from VFP is buggy and limited, you have much stronger programmatic control from VFP where from you can easily tailor your EXCEL VBA code and master Excel objects (including collections with FOR EACH coding structure).

But your VFP code is too intensive like in :

PUBLIC oExcel

oExcel = GETOBJECT("XLS")
oExcel.Application.Visible = .T.
oExcel.Windows(1).Visible = .T.

iLine = 1
SCAN ALL

FOR icolumn=1 TO FCOUNT()
oExcel.Sheets(1).cells(iLine,iColumn).Value = EVALUATE(FIELD(iColumn))
ENDFOR

iLine = iLine + 1
ENDSCAN

RETURN

This become awfully time-consuming. Triggering EXCEL VBA code might solve the speed issue when this is required. I have not tested it.

Regards to all

But I have not tested the code to run a macro from VFP. Which i suppose would bring you additional power.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform