Questions if you’ll please answer them, Schiavinatto: Why does it use 4+ subs? The one I put (hacked) together is all in one sub. What’s the difference? Why the difference? Is there a reason it’s not all in one one sub?
I’d love to learn this stuff. I don’t expect to learn it in a day. Getting to understand it bit by bit here and there appreciated.
The GoToLocal Command is a SubMacro, and normal in a macro looking for information or navigating between sheets several times, this SubMacro makes it easy.
Note that in the first macro the GoToLocal command is used 2x.
The Macro could look like this:
Sub GoToPlan
Dim oSel as Object : Dim Var1$
dim Loc(0) as new com.sun.star.beans.PropertyValue
Loc(0).Name = "ToPoint" : Loc(0).Value = "E7"
CreateUnoService("com.sun.star.frame.DispatchHelper") _
.executeDispatch(ThisComponent.CurrentController.Frame _
, ".uno:GoToCell", "", 0, Loc())
oSel = ThisComponent.getCurrentSelection()
Var1 = oSel.getString()
'msgBox Var1
dim Loc2(0) as new com.sun.star.beans.PropertyValue
Loc2(0).Name = "ToPoint" : Loc2(0).Value = Var1
CreateUnoService("com.sun.star.frame.DispatchHelper") _
.executeDispatch(ThisComponent.CurrentController.Frame _
, ".uno:GoToCell", "", 0, Loc2())
End Sub
The GoToLocal macro can be called from any other macro and serves to go from a single cell (A2) to the area (A2:D5); for Named Area and for Sheet ( Sheet1 ).