BookmarkSubscribeRSS Feed
tom12122
Obsidian | Level 7

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?

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 0 replies
  • 1938 views
  • 1 like
  • 1 in conversation