Hello all,
in a GUI version of MFG/PRO, you can try this. Basically it is possible to remotely control Word, Excel, Outlook and other applications from within any MFG/PRO program if you want to. Let me show you a simple sample
Peter
DEFINE VARIABLE excelAppl AS COM-HANDLE.
def var out-fila as char init "c:\temp\sample.csv".
def var mycol as int.
def var myline as int.
DEFINE VARIABLE col-range AS CHARACTER NO-UNDO.
DEFINE VARIABLE row-range AS CHARACTER NO-UNDO.
OUTPUT TO VALUE (out-file).
/* headlines */
DO mycol = 1 TO 18:
PUT UNFORMATTED "Row " STRING(mycol) ";".
END.
PUT SKIP.
/* Content is king */
myline = 0.
/* use any table you want */
FOR EACH ca_mstr NO-LOCK:
myline = myline + 1.
PUT UNFORMATTED ca_nbr ";"
ca_customer ";"
ca_activity ";"
ca_area ";"
ca_assign ";"
ca_bill ";"
ca_category ";"
ca_created ";"
ca_curr ";"
ca_desc ";"
ca_end_date ";"
ca_enter_by ";"
ca_est_time ";"
ca_lang ";" ca_mod_date ";" ca_mod_userid ";" ca_name ";" ca_nbr.
PUT SKIP.
END.
OUTPUT CLOSE.
col-range = "1:" + string(mycol).
row-range = "A1:A" + string(myline + 1).
/* let´s roll... */
CREATE "Excel.Application" excelAppl.
excelAppl:VISIBLE = true.
excelAppl:Workbooks:OPEN(out-file).
/* column width to an optimal value */
excelAppl:Cells:Select.
excelAppl:Cells:EntireColumn:AutoFit.
/* special procedure for first column */
excelAppl:Range(row-range):Select.
excelAppl:Selection:Interior:ColorIndex = 35.
excelAppl:Selection:Font:Italic = True.
/* special procedure for first line */
excelAppl:Rows("1:1"):Select.
excelAppl:Selection:Font:Bold = True.
excelAppl:Selection:Interior:ColorIndex = 44.
excelAppl:Selection:Borders(9):LineStyle = -4119.
excelAppl:Selection:Borders(9):Weight = 4.
excelAppl:Selection:Borders(9):ColorIndex = -4105.
/* mark first cell */
excelAppl:Range("B2"):Select.
excelAppl:ActiveWindow:FreezePanes = True.
/* now play around with excel */
MESSAGE "Press here to terminate Excel" VIEW-AS ALERT-BOX.
release object excelAppl.