Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Working with excel - empty fields
#1
Hey,

so Im working with excel and got Quick Macros to open a list of links.

Macro Test
Code:
Copy      Help
rep(10)
,#region Recorded 07.07.2016 12:29:54
,opt save; opt slowkeys; opt slowmouse; spe 50
,int w1=act(win("Test - Excel" "XLMAIN"))
,lef 864 16 w1 1
,'Cc
,str s.getclip
,run (s)
,'D

That all works fine however if a field is empty the script will stop.
Is there a way to check if a field is empty and if so, then just move down to the next field instead of stopping the script?
#2
Change this line:
Code:
Copy      Help
run (s)
to
Code:
Copy      Help
if(s.len) run (s)
#3
Still get an error in line 8

Macro Test
Code:
Copy      Help
rep(3)
,#region Recorded 07.07.2016 12:29:54
,opt save; opt slowkeys; opt slowmouse; spe 50
,int w1=act(win("Test - Excel" "XLMAIN"))
,lef 864 16 w1 1
,'Cc
,str s.getclip
,if(s.len) run (s)
,act w1
,'D
#4
Could you run this code and let me know what "s" is when you get the error message?
Macro Test
Code:
Copy      Help
rep(3)
,#region Recorded 07.07.2016 12:29:54
,opt save; opt slowkeys; opt slowmouse; spe 50
,int w1=act(win("Test - Excel" "XLMAIN"))
,lef 864 16 w1 1
,'Cc
,str s.getclip
,out F"s={s}"
,if(s.len) run (s)
,act w1
,'D
By the way why do you need to call "act w1" again at line 9?
#5
Its empty:
s=

basically I want to check earlier if the cell is empty and then just go directly one cell down, repeat.

Yes I needed it, otherwise the 'D would get executed in the browser (It opens links).

Thanks
#6
Run this code and let me know what "s" is again?
Macro Test
Code:
Copy      Help
rep(3)
,#region Recorded 07.07.2016 12:29:54
,opt save; opt slowkeys; opt slowmouse; spe 50
,int w1=act(win("Test - Excel" "XLMAIN"))
,lef 864 16 w1 1
,'Cc
,str s.getclip
,out F"s={s}, s.len={len(s)}"
,if(s.len) run (s)
,act w1
,'D


Forum Jump:


Users browsing this thread: 1 Guest(s)