BookmarkSubscribeRSS Feed
Arjumand
Calcite | Level 5

Hi,

I am getting the following error while writing in excel through dde session:

ERROR: DDE session not ready.

FATAL: Unrecoverable I/O error detected in the execution phase of the DATA step program.

            Aborted during the EXECUTION phase.

 

code I am using:-

 

if fileexist(checklist_doc_path)
then do;


rc=system('"' !! checklist_doc_path !! '" 2>nul' );

submit continue;

filename cmds dde 'excel|[&docname]Checklist!r3c3:r7c3' notab;
data _null_;

** Try Opening the DDE System Channel to winword. *;
do until (fsysid > 0);
fsysid = FOPEN("cmds", 's');
x=sleep(1);
end;
rc = fclose(fsysid);
run;

filename cmds dde "excel|system";

data _null_;
file cmds;
Put '[workbook.activate("Checklist")]';
put '[select("r7c3:r7c3")]';
todaydate=put(Date(),date9.);
put "'" todaydate '0D'x;
put '[save]';
run;

endsubmit;
end;

 

Also, when i reassign my filename from 

filename cmds dde "excel|system";

 

 

to

 

filename cmds dde 'excel|[&docname]Checklist!r3c3:r7c3' notab;

 

I get wrong entries(part of coding) populating my excel sheet. Please help!

1 REPLY 1
Reeza
Super User
Does Excel actually open, you see your file
Open? General process is comment out portions and run until you figure out which line is the issue. Once you've isolated it, post back and we can help with further debugging.

I notice your comments say winword, is this code you're adapting from somewhere else?

This is running on a server, is it a Windows Server with Excel installed.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 1440 views
  • 0 likes
  • 2 in conversation