Home » excel » SAS DDE excel save as without warning

SAS DDE excel save as without warning

Posted by: admin May 14, 2020 Leave a comment

Questions:

I want to save as the excel file using SAS DDE. Anyone know how to turn off the warnings from excel if the file is exist?

Below is the code:

FILENAME DCMDS DDE'EXCEL|SYSTEM';
DATA _null_;
    FILE dcmds;
    PUT "[save.as(""D:\Reports\sme_fwd.xls"")]";
    PUT "[file.close(FALSE,FALSE)]";
RUN;

In VBA we can set Application.DisplayAlerts = False to turn off the warning, but I don’t know what the similar syntax in SAS DDE.

Thank you

How to&Answers:

You can save instead of save.as if you’re working with the same workbook. You can find the DDE references on the Microsoft home page here:
http://support.microsoft.com/kb/128185

 put '[error(false)]';

Answer:

This will allow you to save the file without warning messages

put '[Save.As(" '"' "&savepath" '\' "&savename" '")]' "';
put '[File.Close(false)]';