Ask Your Question

A prerecorded embedded loop causes error msg

asked 2018-12-12 22:16:44 +0100

fbii gravatar image

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("")

'Do Until count >= 22 'I tried starting the loop here. 'same result

dim args1(0) as new 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 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


Message: sequence element is not assignable by given value!. ˄˄˄˄˄˄˄˄˄˄˄˄˄˄˄˄˄˄˄˄˄˄˄˄˄˄˄˄˄˄˄˄˄˄˄˄˄˄˄˄˄˄˄˄˄˄

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2018-12-13 00:12:11 +0100

Ratslinger gravatar image

updated 2018-12-13 00:13:51 +0100


Move your dim args1 & dim args2 to before the start of the loop.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2018-12-12 22:16:44 +0100

Seen: 22 times

Last updated: Dec 13 '18