Suppress Excel 2007 save changes prompt

Accepted Solution Solved
Reply
New Contributor
Posts: 4
Accepted Solution

Suppress Excel 2007 save changes prompt

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.


Accepted Solutions
Solution
‎05-20-2014 02:56 PM
Super User
Posts: 19,869

Re: Suppress Excel 2007 save changes prompt

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


All Replies
New Contributor
Posts: 4

Re: Suppress Excel 2007 save changes prompt

Windows 7 enterprise, 32-bit

SAS 9.2 TS Level 2M3 W32_VSPRO platform

Solution
‎05-20-2014 02:56 PM
Super User
Posts: 19,869

Re: Suppress Excel 2007 save changes prompt

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)]' ;

New Contributor
Posts: 4

Re: Suppress Excel 2007 save changes prompt

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

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 295 views
  • 0 likes
  • 2 in conversation