gpt4 book ai didi

sas - Office 2010 的 SAS DDE 问题

转载 作者:行者123 更新时间:2023-12-01 03:48:47 25 4
gpt4 key购买 nike

当我运行 office 2007 时,我的 SAS DDE 脚本填充、保存和关闭 excel 文件都很好。

我最近更新到 office 2010 并且人口工作正常......但 excel 在保存对话框停止。我必须手动单击“保存”,而我以前不必这样做。

有人知道如何解决这个问题吗?

我正在使用的代码:

filename commands DDE 'EXCEL|SYSTEM';
data _null_;
file commands;
put '[OPEN("pathtoexcelfile.xls")]';
run;

data _null_;
file commands;
put "[Save.as(""&saveas_Path.&saveas..xls"")]";
put "[Close]";
run;

最佳答案

您需要在关闭语句中添加 (0)。这告诉它不要提示。

data _null_;
file commands;
put "[Save.as(""&saveas_Path.&saveas..xls"")]";
put "[Close(0)]";
run;

这是我的完整宏(解释了一些文档类型参数):

/******************************************************************************
** PROGRAM: MACRO.DDE_SAVE_AS.SAS
**
** DESCRIPTION: SAVES THE CURRENT EXCEL FILE. IF THE FILE
** ALREADY EXISTS IT WILL BE OVERWRITTEN.
**
** PARAMETERS: iSAVEAS: THE DESTINATION FILENAME TO SAVE TO.
** iType : (OPTIONAL. DEFAULT=BLANK).
** BLANK = XL DEFAULT SAVE TYPE
** 1 = XLS DOC - OLD SCHOOL! PRE OFFICE 2007?
** 44 = HTML - PRETTY COOL! CHECK IT OUT...
** 51 = XLSX DOC - OFFICE 2007 ONWARDS COMPATIBLE?
** 57 = PDF
**
** NOTES: IF YOU ARE GETTING A DDE ERROR WHEN RUNNING THIS MACRO THEN DOUBLE
** CHECK YOU HAVE PERMISSIONS TO SAVE WHERE YOU ARE TRYING TO SAVE THE
** FILE.
**
*******************************************************************************
** VERSION:
** 1.0 ON: 01APR10 BY: RP
** CREATED.
******************************************************************************/

%macro dde_save_as(iSaveAs=,iType=);
%local iDocTypeClause;

%let iDocTypeClause=;
%if "&iType" ne "" %then %do;
%let iDocTypeClause=,&iType;
%end;

filename cmdexcel dde 'excel|system';
data _null_;
file cmdexcel;
put '[error(false)]';
put "%str([save.as(%"&iSaveAs%"&iDocTypeClause)])";
put '[error(true)]';
run;
filename cmdexcel clear;

%mend;
/*%dde_save_as(iSaveAs=d:\rrobxltest, iType=44);*/

关于sas - Office 2010 的 SAS DDE 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9198071/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com