I never said it was worthless. Deprecated? Yes.
You can only run 1 Excel session at a time. The other sessions will step on
the running one. Someone correct me if I am wrong.
What is needed, IMO, is for each EXCEL READER/WRITER to be an object. Not an
Excel instance (since that has COM legacy around it) but an Excel writer
object that stands alone and handles Excel binary format. I didn't create
this, I simply wrapped it and made it easy for SAS users to work with.
Restart is not a good option, IMO. You won't have multiple versions of Excel
and Word running if you do not use the Excel or Word applications as
objects. When you work with DDE, that is what you are doing. You are
dredging up the entire thing to simply write a spreadsheet.
I am nuts though: I don't accept status quo as how it should be done.
I installed SaviCells on a fresh PC today, copied over 2 test datasets, and
had it running in under 5 mins. Simple, simple, simple. Converted the 2
datasets to a fully formatted spreadsheet and then converted that
spreadsheet back to SAS-compliant XML and did the whole process in a
fraction of a second. Speed courtesy of .NET.
Neither Excel or SAS is installed on the test machine.
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of data
Sent: Wednesday, July 30, 2008 4:46 PM
Subject: Re: DDE Excel problem -- dealing with multiple Excel sessions
Yes, we all know DDE is depreciated and worthless.
However it does work.
And as best as I can tell from here the code you posted works too.
When I submit the code with EXCEL already running it does nothing.
When I submit the code and EXCEL is not running it starts excels with
the default workbook just as if I had started it myself.
So show us some of your other code.
As always with PCs a RESTART is always a good place to start testing.
When I am experimenting with office automation I often have "hidden"
sessions of EXCEL or WORD running that I can see from TASK MANAGER,
but cannot see on my desktop. Some times when I kill them Windows
seems more normal. Other times that does not work. "Windows normal"
is that an oxymoron?
If you can tell us more about you application that would be good too.
Perhaps using another interface to EXCEL will be a better choice.
On 7/30/08, Alan Churchill <email@example.com> wrote:
> Don't use DDE?
> Too flippant, I know. However, you are dealing with COM legacy issues and
> don't believe there is a way around it.
> SaviCells just went out for a quick beta run on the new version. As soon
> I have feedback on it, I will post a link to the download. It handles
> and export from SAS to Excel.
> Alan Churchill
> -----Original Message-----
> From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
> Sent: Wednesday, July 30, 2008 3:49 PM
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: DDE Excel problem -- dealing with multiple Excel sessions
> Everything works great unless there happens to be another instance of
> Excel running, in which case everything turns into chaos. I use a
> standard DDE routine to open an Excel session (see below). The
> problems occur when I try to write to Excel further on down in the
> program -- I end up writing results to the wrong Excel session, or
> worse. Any suggestions?
> %macro openExcel();
> options noxsync noxwait;
> filename sas2xl dde 'excel|system'; * reference to open/close
> excel ;
> data _null_;
> length fid rc start stop time 8;
> if (fid le 0) then do;
> rc=system('start excel');
> do while (fid le 0);
> if (time ge stop) then fid=1;
> %mend openExcel;