Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: 3139 DDEInitiate: Bad Channel Number
DDEChan = DDEInitiate("Excel", "System") ; If DDECHAN is OK, Execute DDE If DDECHAN == 0 result=DDEExecute(1,'[Run("i:\CICS\CICS_Stats|Personal.xls")]') ;this runs an Excel macro ; Close DDE DDETerminate(1) If result == @FALSE Message("DDE Execute", "Failed") else Message("DDE Execute", "Operation Complete") endif else Message("DDE operation unsuccessrful", "Check your syntax") endifWhen I run it, I get :
3139 DDEInitiate: Bad Channel NumberHelp!! What's going on? Am I wrong in thinking that it would dynamically locate the right channel number? If I am wrong, where do I find the right channel number?
DDEChan in resutend by the DdeInitiate command. If it is zero it is NOT OK.
Then DDEExecute needs the channel number like...
DDEChan = DDEInitiate("Excel", "System") ; If DDECHAN is OK, Execute DDE If DDECHAN != 0 result=DDEExecute(DDEChan,'[Run("i:\CICS\CICS_Stats\Personal.xls")]') ;this runs an Excel macro
DDEChan = DDEInitiate("Excel", "System") ; If DDECHAN is OK, Execute DDE If DDECHAN != 0 result=DDEExecute(DDEChan,'[Run("Personal.xls!Macro1")]') ;this runs an Excel macro endif DDETerminate(DDEChan)
This OLE example runs an Excel macro.
; Start excel here excelxls = objectopen("Excel.Application") excelxls.visible = @true rptxls = excelxls.workbooks rptxls.open ("c:\data\excel\TPM Reporting for CSD.xls") ; run the excel macro here the ; macro name is "gina_resolution report and the rname is the parameter passed to it. excelxls.run("gina_resolution_report", rname) ; close up excelxls.quit objectclose(excelxls)You will need to see that product specific documentation....
Article ID: W14140Filename: 3139 DDEInitiate-Bad Channel Number.txtFile Created: 2000:08:30:13:48:52Last Updated: 2000:08:30:13:48:52