Help using Base SAS procedures

DDE commands for Excel

New Contributor
Posts: 2

DDE commands for Excel

I have developed the following code which was working on SAS 9.2, but is now not working on SAS 9.3:

x '"C:\Program Files (x86)\Microsoft Office\Office14\excel.exe"';

data _null_;
z=sleep(3); *Forces SAS to sleep for 3 seconds while Excel opens;

filename ddecmds DDE "excel|sheet1!c1c7";
data _null_;
file ddecmds;
put '[workbook.activate("Sheet1")]';
put '[page.setup("&B&14&""Calibri""Supplemental Kit Evaluation Report (20 Samples)","Page &P",0.25,0.25)]';
put '[insert.picture("\\cpcsrv2\bdm\stats\iC42\Supplemental 20\Programs\ic42 logo6.bmp")]';
put '[format.size(476,80)]';
put '[select("C1")]';
put '[Column.Width(4)]%';
put '[select("C2")]';
put '[Column.Width(12)]%';
put '[select("C3")]';
put '[Column.Width(24)]%';
put '[select("C4:C6")]';
put '[Column.Width(12)]%';
put '[select("C7")]';
put '[Column.Width(13)]%';

Any suggestions?

Super User
Posts: 10,500

Re: DDE commands for Excel

By any chance are you running Cisco Jabber? That, and possibly  a few other applications, interfere with DDE commands. If so, shut down Jabber. THEN use Task Manager to KILL the process still running.

I had some issues using the X command, which you may have an admin preventing you from using, to start Excel.

I use (with my very limited DDE experience)

%let rc=%sysfunc(system(start Excel));

   /* wait to make sure excel is done starting, the number is seconds of delay

      the value can be smaller for faster disk drives*/

   %let rc=%sysfunc(sleep(2));

And a third place is I had to explicitly address the file format to match the version of Excel in a save command.

New Contributor
Posts: 2

Re: DDE commands for Excel

Most of my DDE commands later in the program are working. The X command is working fine. And the save command is working.

Super User
Posts: 17,828

Re: DDE commands for Excel

So which lines aren't running? Break it up and run it either line by line or binary search to see where the issue is.

My first check would be that the macro variables are resolving properly.

Is it the same version of Excel?

Ask a Question
Discussion stats
  • 3 replies
  • 3 in conversation