BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
B_caapi
Calcite | Level 5

Does anyone know how to use the DDE system topic to suppress the save changes prompt I get when closing excel?

My code is:

%MACRO SAVEAS(FILE);

OPTIONS NOXWAIT NOXSYNC;

*** Open Excel file ***;

x "start excel";

data _null_ ; x = SLEEP(2) ; run ;

filename cmds DDE 'excel|system' ;

data _null_ ;

file cmds ;

string1 = '[FILE-OPEN("'||"&dir.\&&FILE..xls"||'")]';

put string1;

PUT '[ERROR(FALSE)]';

string5 = '[save.as("'||"&dir.\&&FILE..txt"||'",3)]';

put string5;

put '[QUIT()]' ;

RUN;

%MEND SAVEAS;

I'm trying to add a control program to run 6 sets of code but it stops each iteration and waits for me to click "no" before moving on.

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

Close the file before quitting, specifying save or not save. Not sure how you specify the logical.

I think I've used

put '[close(0)]';

Or it could be:

put '[close(FALSE)]' ;

View solution in original post

3 REPLIES 3
B_caapi
Calcite | Level 5

Windows 7 enterprise, 32-bit

SAS 9.2 TS Level 2M3 W32_VSPRO platform

Reeza
Super User

Close the file before quitting, specifying save or not save. Not sure how you specify the logical.

I think I've used

put '[close(0)]';

Or it could be:

put '[close(FALSE)]' ;

B_caapi
Calcite | Level 5

Thanks Reeza. put '[close(0)]'; worked.

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
  • 3 replies
  • 790 views
  • 0 likes
  • 2 in conversation