Date: Fri, 13 Feb 2004 10:05:09 -0500
Reply-To: Methodios Typou <methodios.2.typou@GSK.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Methodios Typou <methodios.2.typou@GSK.COM>
Subject: Re: dde with Excel when calling a VB function: dde session not
ready
On Mon, 28 Oct 2002 16:50:51 -0800, Oeufinc <oeufinc@YAHOO.COM> wrote:
>Excel is launched, still got the problem. It works fine if I just want to
select cells, but calling the VB macro makes difficulties.
> Jim Loughlin <jcloughl@isza.com> wrote:You need to have excel launched.
>
>
>----- Original Message -----
>From: "Oeufinc"
>Newsgroups: bit.listserv.sas-l
>To:
>Sent: Monday, October 28, 2002 4:44 PM
>Subject: dde with Excel when calling a VB function: dde session not ready
>
>
>Hi there,
>
>when trying to call a VB macro thru SAS, I got a very strange error
message:
>
>
>
>ERROR: DDE session not ready.
>
>FATAL: Unrecoverable I/O error detected in the execution of the data step
>program.
>
>Aborted during the EXECUTION phase.
>
>
>
>I am using following code:
>
>filename cmds dde 'excel|system';
>
>data _null_;
>
>file cmds;
>
>put "[RUN('m2test.xls'!MyMacroName]";
>
>run;
>
>I am using Excel2000.
>
>I appreciate your help. Thank you very much in advance.
>
>
>
>Natasa
Hi Natasa,
I face a very similar problem to yours (posted at the SAS-L on October 28,
2002 ).
I was wondering whether you have solved your problem and if so how?
I get a similar error message by runing the code below. The first step
ensures that Excel is lanched (this works fine). The second step is
supposed to be opening my excel file...
Thanks in advance for the help that you may be able to give me.
Methodios Typou
options noxwait noxsync mlogic mprint symbolgen;
filename xl dde "excel|system" command;
data _null_;
fid=fopen('xl','S');
if fid le 0 then do;
rc=system("Start Excel");
start=datetime();
stop=start+5;
do while(fid le 0);
fid=fopen('xl','S');
time=datetime();
if time ge stop then fid=time;
end;
end;
rc=fclose(fid);
run;
NOTE: DATA statement used:
real time 0.11 seconds
cpu time 0.01 seconds
data _null_;
file xl;
put "[open('M:\demo dataset.xls')]";
run;
NOTE: The file XL is:
DDE Session,
SESSION=excel|system,RECFM=V,LRECL=256
ERROR: DDE session not ready.
FATAL: Unrecoverable I/O error detected in the execution of the data step
program.
Aborted during the EXECUTION phase.
NOTE: 0 records were written to the file XL.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: DATA statement used:
real time 0.09 seconds
cpu time 0.00 seconds