DATA Step, Macro, Functions and more

copy existing worksheets in Excel from SAS

Reply
Contributor
Posts: 60

copy existing worksheets in Excel from SAS

Hi,

I have existing Excel file with one worksheet with some graphs. I need to make many copies of this worksheet using SAS and to preserve existing objects.

I thought about calling worksheets.copy VBA command but I somehow can't get it working:

options noxwait noxsync missing=' ' ;

/* Invoke Microsoft Excel. */

X "C:\Program Files\Microsoft Office\Office12\EXCEL.EXE";

data _null_;

rc = sleep(8);

run;

filename sas2xls dde 'excel|system';

data _null_;

file sas2xls;

put "[open(""C:\xls\test2.xls"", 0 , true)]";

put "[Sheets(""Sheet2"").Select]";

put "[Sheets(""Sheet2"").Copy Before:=Sheets(1)]";

run;

Can someone help me?

Ask a Question
Discussion stats
  • 0 replies
  • 680 views
  • 1 like
  • 1 in conversation