smart.Object
Member
Hello everyone. I have encountered yet another problem in converting my program to a later version of progress (8 --> 9). In 8 I used to be able to export data to excel with this procedure:
and this xlmove.i file:
However in progress 9 it compiles fine but doesn't seem to INITIATE sys, setting it to 0 and returning "Excel not available" message.
I have been trying to get this to work for 4 days now and quite frankly dumbfounded by the situation.
I appreciate any help from you guys
Thanks -Greg.
P.S. both of those files work in progress 8.
Code:
&ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE p_graph dialog-1
PROCEDURE p_graph :
/*------------------------------------------------------------------------------
Purpose:
Parameters: <none>
Notes:
------------------------------------------------------------------------------*/
def var xlfile as char init "carreportPRINT.xls" no-undo.
{excel\xlmove.i}
DDE EXECUTE sys COMMAND "[new(carreport)]" TIME 15 NO-ERROR.
DDE INITIATE sheet FRAME FRAME MainFrame:HANDLE APPLICATION "Excel" TOPIC "bestschedulereport" NO-ERROR.
rowi = 2.
for each car where
car.car-no = hold-car-no
use-index order-no no-lock
break by car.car-no:
find customer where customer.company = "01" and customer.cust-id = car.cust-id no-lock no-error.
find job-hdr where job-hdr.company = "01" and job-hdr.order-no = car.order-no no-lock no-error.
DDE SEND sheet SOURCE string(car.init-by)
ITEM ("R" + STRING(rowi) + "C2")
TIME 15 NO-ERROR.
DDE SEND sheet SOURCE string(car.car-no)
ITEM ("R" + STRING(rowi) + "C1")
TIME 15 NO-ERROR.
DDE SEND sheet SOURCE car.order-no
ITEM ("R" + STRING(rowi) + "C3")
TIME 15 NO-ERROR.
DDE SEND sheet SOURCE customer.name
ITEM ("R" + STRING(rowi) + "C4")
TIME 15 NO-ERROR.
DDE SEND sheet SOURCE job-hdr.slsprsn
ITEM ("R" + STRING(rowi) + "C5")
TIME 15 NO-ERROR.
DDE SEND sheet SOURCE car.description
ITEM ("R" + STRING(rowi) + "C6")
TIME 15 NO-ERROR.
DDE SEND sheet SOURCE string(CAR.init-date)
ITEM ("R" + STRING(rowi) + "C7")
TIME 15 NO-ERROR.
DDE SEND sheet SOURCE car.dept-resp
ITEM ("R" + STRING(rowi) + "C8")
TIME 15 NO-ERROR.
DDE SEND sheet SOURCE CAR.wrk-center
ITEM ("R" + STRING(rowi) + "C9")
TIME 15 NO-ERROR.
DDE SEND sheet SOURCE CAR.X-CHAR[4]
ITEM ("R" + STRING(rowi) + "C10")
TIME 15 NO-ERROR.
rowi = rowi + 1.
DDE SEND sheet SOURCE car.pro-desc
ITEM ("R" + STRING(rowi) + "C2")
TIME 15 NO-ERROR.
DDE SEND sheet SOURCE "Problem:"
ITEM ("R" + STRING(rowi) + "C1")
TIME 15 NO-ERROR.
DDE SEND sheet SOURCE string(car.npb-no)
ITEM ("R" + STRING(rowi) + "C3")
TIME 15 NO-ERROR.
DDE SEND sheet SOURCE CAR.cont-action
ITEM ("R" + STRING(rowi) + "C5")
TIME 15 NO-ERROR.
DDE SEND sheet SOURCE "Contain:"
ITEM ("R" + STRING(rowi) + "C4")
TIME 15 NO-ERROR.
DDE SEND sheet SOURCE car.preven-act
ITEM ("R" + STRING(rowi) + "C7")
TIME 15 NO-ERROR.
DDE SEND sheet SOURCE "Cause:"
ITEM ("R" + STRING(rowi) + "C6")
TIME 15 NO-ERROR.
DDE SEND sheet SOURCE car.root-cause
ITEM ("R" + STRING(rowi) + "C9")
TIME 15 NO-ERROR.
DDE SEND sheet SOURCE "Prevent:"
ITEM ("R" + STRING(rowi) + "C8")
TIME 15 NO-ERROR.
ASSIGN
rowi = rowi + 1.
end.
hide frame f-menu no-pause.
hide message no-pause.
/* End Query Section */
END PROCEDURE.
Code:
/* xlmove.i
jao - 02/25/98
- copies the excel file into local temp dir so that any changes made
in the spreadsheet will not be written to the master copy
- also sets up the DDE link using a unique file name
Modifications:
08/07/98 - jao - updated for 32-bit
*/
DEF VAR v-path AS CHAR NO-UNDO.
DEF VAR vReportsPath AS CHAR NO-UNDO.
DEF VAR vString AS CHAR NO-UNDO.
DEF VAR vExcelPath AS CHAR NO-UNDO.
DEF VAR vExcelFiles AS CHAR NO-UNDO.
DEF VAR xltemp as char no-undo.
def var hProcess as int no-undo.
def var nTask as int no-undo.
IF excelon = TRUE THEN RETURN.
BtnGraph:sensitive in frame {&FRAME-NAME}= NO.
GET-KEY-VALUE SECTION "Shoppro Parameters" KEY "ExcelPath" VALUE vExcelPath.
GET-KEY-VALUE SECTION "Shoppro Parameters" KEY "ExcelFiles" VALUE vExcelFiles.
/* Get the starting directory for report files */
get-key-value section "Shoppro Parameters" key "ReportsPath" value vReportsPath.
ASSIGN v-path = IF vReportsPath = ? THEN 'temp\' ELSE vReportsPath.
IF SUBSTRING(v-path,LENGTH(v-path),1) NE "\" THEN v-path = v-path + "\".
do-block:
DO WHILE TRUE:
ASSIGN xltemp=
v-path
+ STRING((TIME),'99999999')
+ '.xls'.
IF SEARCH(xltemp) = ? THEN LEAVE do-block.
END.
os-copy value(vExcelFiles + xlfile) value(xltemp).
xltemp = search(xltemp).
ASSIGN
vString = vExcelPath + "excel /e " + xltemp
excelon = TRUE.
RUN WinExec in hpApi(INPUT vString, INPUT 1, OUTPUT nTask). /* 1=normal 2=minimized */
DDE INITIATE sys FRAME FRAME MainFrame:HANDLE APPLICATION "Excel" TOPIC "System" NO-ERROR.
IF sys = 0 THEN DO:
MESSAGE "Excel not available" VIEW-AS ALERT-BOX ERROR.
excelon = FALSE.
RETURN.
END.
I have been trying to get this to work for 4 days now and quite frankly dumbfounded by the situation.
I appreciate any help from you guys
Thanks -Greg.
P.S. both of those files work in progress 8.