Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DDE COMMANDS

Status
Not open for further replies.

IncredibleVolk

Technical User
Apr 2, 2004
67
US
I'm using a script that grabs information off the terminal screen and places it into Excel. The script works great but I'm having difficulty doing two things.

1. Deleting a column in Excel
2. Renaming a worksheet in the workbook.

I think this delete logic is incorrect but I don't know the correct logic to use for deleting a column.

if Number3a == 0
ddeexecute LinkVar "[SELECT(`"C2`")]"
ddeexecute LinkVar "[DELETE(`"C2`")]"
endif

I believe this is incorrect as well:

ddeexecute LinkVar "[WORKBOOK.SELECT(`"Sheet1`")]"
ddepoke LinkVar "Sheet1" "Test"
 
You can use this command:

ddeexecute LinkVar "[EDIT.DELETE]"

to delete the currently-selected cell, column, row, etc. (see the help file I mentioned in the other thread you posted for more information on the optional parameters this command can take). You could also use this command if you just wanted to clear the values instead of deleting the cells:

ddeexecute LinkVar "[CLEAR]"

To select Sheet2, you would want to use this command:

ddeexecute SystemVar "[WORKBOOK.SELECT(`"sheet2`")]"

before you use a command similar to this:

if ddeinit LinkVar "excel" "sheet2"

aspect@aspectscripting.com
 
I tried using ddeexecute LinkVar "[EDIT.DELETE]" and it placed a " in the cell. I'll try it again.
 
I tried again this afternoon and it still worked OK. Did your script perform a selection of some sort in the spreadsheet prior to the deletion? One thing to keep in mind is that the column or row that shifts to take the place of the deleted cells will be selected, so it may appear that nothing occurred.


aspect@aspectscripting.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top