Thanks to all who assisted me with my previous post. I believe I'm making some progress with my project. However, now I've come across another problem that has me stumped.
When I run the script below, the data pasted in notepad from Excel has extra carriage returns in it. What I expected to get in notepad would be:
Cell1Cell2Cell3Cell4
What I got was:
Cell1
Cell2
Cell3
Cell4
Does anyone know where the carriage returns came from? They were not in my Excel data, I ran the Clean function on them to remove any unprintable characters, but it didn't help. Has anyone seen this before? Thanks in advance for your help.
Eric
My Script is below
Let>row=1
Let>col=1
Label>startofloop
DDERequest>Excel,c:\SENDKEYS.xls,R%row%C%col%,xdata,2
If>row=4,exitloop
Setfocus>Untitled - Notepad
Send Character/Text>%xdata%
Add>row,1
Goto>startofloop
Label>exitloop
Message>done!
Unusual problem with Send> extra characters from Excel?
Moderators: JRL, Dorian (MJT support)
//Divide the cell content with 1, this should remove the CRLF
or use (changes are bold)
Let>row=1
Let>col=1
Let>ydata=
...
Label>startofloop
DDERequest>Excel,c:\SENDKEYS.xls,R%row%C%col%,xdata,2
ConCat>ydata,%xdata%
If>row=4,exitloop,startofloop
Label>exitloop
Setfocus>Untitled - Notepad
Send Character/Text>%ydata%
Message>done!

Code: Select all
Let>xdata=%xdata%/1
Let>row=1
Let>col=1
Let>ydata=
...
Label>startofloop
DDERequest>Excel,c:\SENDKEYS.xls,R%row%C%col%,xdata,2
ConCat>ydata,%xdata%
If>row=4,exitloop,startofloop
Label>exitloop
Setfocus>Untitled - Notepad
Send Character/Text>%ydata%
Message>done!
Thanks for the quick reply. However, I don't think I can divide the cell contents by 1, since the contents are a string. When I tried that the result I got was
Cell1/1
On the code below that, what does ydata do? I'm not sure what it is doing.
On a side note, I have found that there are two characters that are being added to the end of the cell content string. I am now looking at using a VB function to trim off the last two characters. Do you think that would work?
Thanks,
Eric
Cell1/1
On the code below that, what does ydata do? I'm not sure what it is doing.
On a side note, I have found that there are two characters that are being added to the end of the cell content string. I am now looking at using a VB function to trim off the last two characters. Do you think that would work?
Thanks,
Eric
Have you tried the sample code? Afterwards you would have realized that:
a) to the (previously empty) variable ydata, the content of xdata will be concatinated. With every loop ydata will "grow". The result: a single line with the content of all cells.
ydata=Cell1
ydata=Cell1Cell2
ydata=Cell1Cell2Cell3
ydata=Cell1Cell2Cell3Cell4
b) to get rid of 2 additional characters
Length>xdata,xlen
Sub>%xlen%,2
MidStr>%xdata%,1,%xlen%,xdata
a) to the (previously empty) variable ydata, the content of xdata will be concatinated. With every loop ydata will "grow". The result: a single line with the content of all cells.
ydata=Cell1
ydata=Cell1Cell2
ydata=Cell1Cell2Cell3
ydata=Cell1Cell2Cell3Cell4
b) to get rid of 2 additional characters
Length>xdata,xlen
Sub>%xlen%,2
MidStr>%xdata%,1,%xlen%,xdata