Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

SAS - Unprotect an Excel sheet from SAS using DDE

Avatar of vadnick
vadnick asked on
2 Comments1 Solution1475 ViewsLast Modified:
I'm using dde from SAS to populate a sheet within an elaborate Excel workbook.  When the sheet is unprotected, the data fills in perfectly.  But, when it's protected, as it needs to be, nothing fills in.  Is there a way to use dde to unprotect the sheet, populate the data, and then reprotect the sheet?  If not, is there another method to populate a protected Excel sheet from within SAS?


Here's some of my code:

options noxwait noxsync;
x "'C:\Program Files\Microsoft Office\Office11\EXCEL'";

/* Sleep to give Excel time to come up. */
data _null_;

filename cmds dde "excel|system";

data _null_;
   file cmds;
   put '[open("\\mynetdrive\files\temp.xls")]';

*** Allow time for file to open ***;
data _null_;

*** Map Detail ***;
filename field1  dde 'EXCEL|Sheet1!R2C1:R200C1' notab;
filename field2  dde 'EXCEL|Sheet1!R2C2:R200C2' notab;

*** Place Detail ***;
data _null_; set hold1;
file field1;  put field1data;
file field2;  put field2data;

*** Close down Excel ***;
filename cmds dde 'EXCEL|SYSTEM';

data _null_;
   file cmds;    
   put '[SAVE()]';
   put '[QUIT()]';  
Avatar of DarthMod
DarthModFlag of United States of America image

Our community of experts have been thoroughly vetted for their expertise and industry experience.

This problem has been solved!
Unlock 1 Answer and 2 Comments.
See Answers