The integrated cross-platform development tool for ANSI Common Lisp LispWorks logo

Lisp Knowledgebase



Title: How to connect to Excel from LispWorks via DDE

ID: 10044


Product: LispWorks for Windows
Version: All
OS: All Windows platforms

Description:
For testing DDE-Excel connection, here's what we recommend. The simplest
function to use is DDE-REQUEST* since this opens a conversion automatically
(the related function DDE-REQUEST needs a connection already opened by
DDE-CONNECT etc, which is more efficient for repeated requests to the same program).

Here's an example session, with comments.

>;; --------------------------------------------------------------------------
>;; Before this, start Excel and enter 1, 2 and 333 into the cells A1, A2 and
>A3 of Sheet1.
>
>CL-USER 1 > (require "dde")
>; Loading fasl file C:\Program Files\Harlequin\LispWorks\lib\4-1-0-0\modules\concat\dde.fsl
> T
>
>;; First we find out what the current Excel topics are.  These will depends on
>;; the name of the open workbooks and sheets.
>CL-USER 2 > (w::dde-request* "excel" "system" "topics")
>"[Book1]Sheet1 [Book1]Sheet10 [Book1]Sheet11 [Book1]Sheet12
> [Book1]Sheet13 [Book1]Sheet14 [Book1]Sheet15 [Book1]Sheet16
> [Book1]Sheet2 [Book1]Sheet3 [Book1]Sheet4 [Book1]Sheet5
> [Book1]Sheet6 [Book1]Sheet7 [Book1]Sheet8 [Book1]Sheet9
> System"
>T
>
>;; Get the contents of cell A1 (using row and column notation).
>CL-USER 3 > (w::dde-request* "excel" "[Book1]Sheet1" "R1C1")
>"1
>"
>T
>
>;; Ditto A2.
>CL-USER 4 > (w::dde-request* "excel" "[Book1]Sheet1" "R1C2")
>"2
>"
>T
>
>;; Ditto A2.
>CL-USER 5 > (w::dde-request* "excel" "[Book1]Sheet1" "R1C3")
>"333
>"
>T
>
>;; Get the contents of cells A1 thru A3 in one request.
>CL-USER 6 > (w::dde-request* "excel" "[Book1]Sheet1" "R1C1:R1C3")
>"1 2 333
>"
>T
>

See Also:
Workaround:
Patch:

Hardware:N/A
Summary:
Bug#:
Patch Enhancement#:
Reported:6126

Top | Back