need help macro loop (calc 3.1)

khobbos khobbos khobbos at live.com
Sat Feb 27 08:57:04 UTC 2010





	
	
	
	

Dear
sir
I
want to make a macro in calc 3.1



Simply


I
wrote a formula in cell NB (A1)
I
want to jump to cell NB (A3) and paste the same




So I record this macro and
everything goes well
sub
Main13
rem
----------------------------------------------------------------------
rem
define variables
dim
document   as object
dim
dispatcher as object
rem
----------------------------------------------------------------------
rem
get access to the document
document
  = ThisComponent.CurrentController.Frame
dispatcher
= createUnoService("com.sun.star.frame.DispatchHelper")
rem
----------------------------------------------------------------------
dispatcher.executeDispatch(document,
".uno:Copy", "", 0, Array())
rem
----------------------------------------------------------------------
dim
args2(1) as new com.sun.star.beans.PropertyValue
args2(0).Name
= "By"
args2(0).Value
= 1
args2(1).Name
= "Sel"
args2(1).Value
= false
dispatcher.executeDispatch(document,
".uno:GoDown", "", 0, args2())
rem
----------------------------------------------------------------------
dim
args3(1) as new com.sun.star.beans.PropertyValue
args3(0).Name
= "By"
args3(0).Value
= 1
args3(1).Name
= "Sel"
args3(1).Value
= false
dispatcher.executeDispatch(document,
".uno:GoDown", "", 0, args3())
rem
----------------------------------------------------------------------
dispatcher.executeDispatch(document,
".uno:Paste", "", 0, Array())

end sub

now I need to do a loop so I can
for example repeat the same 10 times

after googling I found this
lines
Dim
I
For
I = 1 to 10
	‘…
Inner part of loop
Next
I

So I edit the macro in this way
sub
Main13
rem
----------------------------------------------------------------------
rem
define variables
dim
document   as object
dim
dispatcher as object
rem
----------------------------------------------------------------------
rem
get access to the document
document
  = ThisComponent.CurrentController.Frame
dispatcher
= createUnoService("com.sun.star.frame.DispatchHelper")
dim
i
for
i = 1 to 2
rem
----------------------------------------------------------------------
dispatcher.executeDispatch(document,
".uno:Copy", "", 0, Array())
rem
----------------------------------------------------------------------
dim
args2(1) as new com.sun.star.beans.PropertyValue
args2(0).Name
= "By"
args2(0).Value
= 1
args2(1).Name
= "Sel"
args2(1).Value
= false
dispatcher.executeDispatch(document,
".uno:GoDown", "", 0, args2())
rem
----------------------------------------------------------------------
dim
args3(1) as new com.sun.star.beans.PropertyValue
args3(0).Name
= "By"
args3(0).Value
= 1
args3(1).Name
= "Sel"
args3(1).Value
= false
dispatcher.executeDispatch(document,
".uno:GoDown", "", 0, args3())
rem
----------------------------------------------------------------------
dispatcher.executeDispatch(document,
".uno:Paste", "", 0, Array())
next
i

end sub
now
I am getting this message : sequence element is not assignable by
given value!






So
plz can any one help me with this




Many
thanks



Regard’s
 		 	   		  
_________________________________________________________________
Hotmail: Free, trusted and rich email service.
https://signup.live.com/signup.aspx?id=60969
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20100227/2fd2d778/attachment.html>


More information about the ubuntu-users mailing list