WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

DDE

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

How are the DDE commands used?

Keywords:        DDE commands command format help wbt

Winbatch DDE functions

WinBatch is a client. It must initiate the connection and transaction. The DDE commands that applications respond to are documented by the individual applications; WinBatch just sends those commands.

The DDEInitiate broadcasts a plea for help and talks with the first one that responds.

Here is some sample code that drives Excel.

You cannot run this as is, but it may give you some idea of what the code looks like.

Sample DDE code:

pokechan=DDEInitiate("Excel",SheetName) 
DDEPoke(pokechan,"R1C1","Symbol")
DDEPoke(pokechan,"R1C2","Company") 
DDEPoke(pokechan,"R1C3","Date")
DDEPoke(pokechan,"R1C4","Hi/Ask") 
DDEPoke(pokechan,"R1C5","Low/Bid")
DDEPoke(pokechan,"R1C6","Last") 
DDEPoke(pokechan,"R1C7","Change")
DDEPoke(pokechan,"R1C8","Volume") 
DDEPoke(pokechan,"R1C9","Delta->")
DDEPoke(pokechan,"R1C10","=$F31-$F30") 
DDETerminate(pokechan)

DDEExecute(channel,`[SAVE.AS("%SheetName%")]`)

If FileExist(ChartName) then FileDelete(ChartName)

DDEExecute(channel,`[NEW(2)]`) 
DDEExecute(channel,`[GALLERY.LINE(8)]`)
DDEExecute(channel,`[ATTACH.TEXT(1)]`) 

Title="%TheQuote% Month of %MonthText%"

DDEExecute(channel,`[FORMULA("%Title%")]`)
DDEExecute(channel,`[SAVE.AS("%ChartName%")]`)
DDEExecute(channel,`[SELECT.CHART]`)
DDEExecute(channel,`[WINDOW.SIZE(310,255)]`)
DDEExecute(channel,`[COPY.PICTURE(1,1,2)]`)
DDEExecute(channel,`[CLOSE(FALSE)]`) 
DDEExecute(channel,`[CLOSE(TRUE)]`)

Question:

How do I get the value of a cell in excel spread sheet using dde. I can open the workbook, select the sheet and select the cell. I can not find the right syntax for DDERequest to get the value of the cell.

Answer:

You will need to get the DDE Documentation sorted out, but you can try...
   cellval = DDERequest (channelID, "RxCy")
where channelID is the DDE channel ID to the open Excel worksheet and x and y are the row and column numbers respectively. Alternatively, you can say
    cellval = DDERequest (channelID, "name")
where name is a defined name of a cell range of the open worksheet.
Article ID:   W12815
Filename:   How are the DDE commands used - Excel example.txt
File Created: 1999:04:15:16:49:50
Last Updated: 1999:04:15:16:49:50