LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (February 2000, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 18 Feb 2000 21:50:17 GMT
Reply-To:     stephno1@MY-DEJA.COM
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         stephno1@MY-DEJA.COM
Organization: Deja.com - Before you buy.
Subject:      Help-SAS/EXCEL/WORD/DDE

I am trying to export data from SAS to excel, using excel to create a chart and then exporting certain cells and the chart to Word. At first, I was trying to create a Word Macro to do the copying and pasting from Excel, but I could not get that to work. Then, in trying to work around it, I did a series of

From SAS tell Excel to select (cell/range of cells/chart) and copy Then run Word macros that pasted from the clipboard and moved the cursor to the next insertion point

However, I hit a glitch. When you copy in Excel, the selection stays active (ie the moving border). Because of that, the word macro will run but when SAS goes to send the next command to Excel, I get an error because Excel is busy and can not accept the command.

If you can help or come up with a new way to do this, please let me know.

The code looks like... *Run the macro 'frmexcl1' to copy the template and place cursor at position for UPIN.* *This macro is contained in Word in the normal template.; data _null_; filename cmdword dde 'WINWORD|SYSTEM'; file cmdword; put '[ToolsMacro .Name = "frmexcl1", .Run]'; run;

*Select the cell containing ID and copy to clipboard'. data _null_; selcmd='[SELECT("r1c2","r1c2")]'; cpycmd='[COPY]'; file cmds; put selcmd; put cpycmd; run;

*Run the macro 'frmexcl2' to copy the UPIN and place cursor at position for table.* *This macro is contained in Word in the normal template.; data _null_; file cmdword; put '[ToolsMacro .Name = "frmexcl2", .Run]'; run;

*Select the cells containing the table and copy to clipboard'. data _null_; selcmd2='[SELECT("r1c1","r6c11")]'; cpycmd='[COPY]'; file cmds; put selcmd2; put cpycmd; run;

*Run the macro 'frmexcl3' to copy the table and place cursor at position for chart.* *This macro is contained in Word in the normal template.; data _null_; file cmdword; put '[ToolsMacro .Name = "frmexcl3", .Run]'; run;

*Select the chart and copy to clipboard'. data _null_; selchrt='[SELECT("CHART")]'; cpycmd='[COPY]'; file cmds; put selchrt; put cpycmd; run;

*Run the macro 'frmexcl4' to copy the chart and place cursor at position for next run.* *This macro is contained in Word in the normal template.; data _null_; file cmdword; put '[ToolsMacro .Name = "frmexcl4", .Run]'; run;

Sent via Deja.com http://www.deja.com/ Before you buy.


Back to: Top of message | Previous page | Main SAS-L page