Excel's Empty Cell Isn't Read As Empty

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
tomagogame
Newbie
Posts: 4
Joined: Wed Oct 17, 2007 1:16 am

Excel's Empty Cell Isn't Read As Empty

Post by tomagogame » Wed Oct 17, 2007 1:22 am

Hi,

I'm still using the evaluation script with 13 days left. I hope I can get help ASAP.

This one should be easy.

As in the examples contained within the help of macro scheduler 9, before transfering data from excel to notepad, it asks for a user input.

I want to loop through the rows without requesting a value from user.

The macro will read the cell's value as it loops down. When it hits something empty, it will stop.

I've managed to do it, however in a 'weird' way.

Code: Select all

Let>r=1
Let>recordlen=5

'
' loop till empty cell
'
Repeat>recordlen

DDERequest>Excel,filename,R%r%C12,bvpvmsg,60
press down
wait>0.5

DDERequest>Excel,filename,R%r%C1,record,60
Length>record,recordlen

Let>r=r+1
until>recordlen=2 'empty cell
as you can see, the until>recordlen=2 is actually an empty cell. That's the weird thing.

It works but there's no logic as far as i can see.

In other words, a cell with "abc" has the length of 5.

Apart from this, is there any other way to detect an empty cell?

Regards,
David.

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Wed Oct 17, 2007 1:39 am

The issue is that the DDERequested cell data always comes over with a CRLF added on the end, and that's what gives the length of 2 for an empty cell. Your method is OK, you could do something with filtering out CRLF's, but that could backfire because a text cell can legitimately include a CRLF.

tomagogame
Newbie
Posts: 4
Joined: Wed Oct 17, 2007 1:16 am

Post by tomagogame » Wed Oct 17, 2007 1:41 am

Hah, guess that was simple enough. I'll take note of that invisible CRLF then.

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Wed Oct 17, 2007 3:16 am

The "Extract from Excel" example macro supplied with MacroScheduler includes code to filter out the CRLF's.

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts