I am in need of some help. Here is the problem.
I am trying to implement a loop and part of the wording is pulled from
a recorded macro I made some time ago. This is embedded about half way down.
count = 0
DO UNTIL count >= 22 'start do loop
dim document as object
dim dispatcher as object
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService(“com.sun.star.frame.DispatchHelper”)
'Do Until count >= 22 'I tried starting the loop here.
'same result
dim args1(0) as new com.sun.star.beans.PropertyValue
args1(0).Name = “Text”
args1(0).Value = “GoTo the next one”
dispatcher.executeDispatch(document, “.uno:InsertText”, “”, 0, args1()
'The second time around when this is called I get an error msg
'which is shown at the bottom of the text
dim args2(1) as new com.sun.star.beans.PropertyValue
args2(0).Name = “Howmany”
args2(0).Value = 1
args2(1).Name = “Select”
args2(1).Value = false
’ put the cursor into the next blank cell
dispatcher.executeDispatch(document, “.uno:GoRight”, “”, 0, args2())
count = count + 1
LOOP 'end of the main loop
'The first time around this works OK however
So, I cannot figure out something to work around this. It must be that
the args are taken in sequence and once used,
like args1(0) and args2(0), etc. I’m stymied.
Thanks for reading this!
fb
˅˅˅˅˅˅˅˅˅˅˅˅˅˅˅˅˅˅˅˅˅˅˅˅˅˅˅˅˅˅˅˅˅˅˅˅˅˅˅˅˅˅˅˅˅˅
Error msg
BASIC runtime error.
An exception occurred
Type: com.sun.star.lang.IllegalArgumentException
Message: sequence element is not assignable by given value!.
˄˄˄˄˄˄˄˄˄˄˄˄˄˄˄˄˄˄˄˄˄˄˄˄˄˄˄˄˄˄˄˄˄˄˄˄˄˄˄˄˄˄˄˄˄˄