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.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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