p********a 发帖数: 5352 | 3 *-> Macro to Combine Worksheets;
%macro many2one(in=,out=);
options noxwait;
x erase "&out";
options xwait;
data _null_;
file "c:\temp\class.vbs";
put 'Set XL = CreateObject("Excel.Application")' /
'XL.Visible=True';
%let n=1;
%let from=%scan(&in,&n," ");
%do %while("&from" ne "");
%let fromwb=%scan(&from,1,"!");
%let fromws=%scan(&from,2,"!");
put "XL.Workbooks.Open ""&fromwb""";
%if &n=1 %then
put "XL.ActiveWorkbook.SaveAs ""&out"", -4143"%str(;);
%else %do;
put "XL.Workbooks(""%scan(&fromwb,- |
|