Posted: Sun Dec 02, 2007 2:25 pm Post subject: Go To Page?
Sorry if this question has an obvious answer somewhere in Help or these fora, I've not been able to find it... but is there a Neo/OOo equivalent for Word's Go To Page cmd-G? And if not, has anyone written a macro to do this, that you know of?
Joined: Jun 20, 2006 Posts: 2051 Location: Midwest, USA
Posted: Sun Dec 02, 2007 3:06 pm Post subject:
There's a "Jump to Page" box in the Navigator window.
In Tools>Customize>Keyboard, it is the "To Page" function in The "Navigate" category. That pullsup the Navigator window and puts the cursor in the Jump to Page box.
I found this macro on this OOoForum thread - seems to work nicely, though it's a bit of a huge display box, and I haven't found a way yet to make it less wide.
Code:
Sub GoToPage 'Written by JohnV
Def = PriorPjcv
Def = Lcase(Def)
oVC = thisComponent.CurrentController.getViewCursor
CurrentP = oVC.getPage
If Not ShowDef then Def = ""
Info = "Current Page = " & CurrentP
If PriorPjcv <> "" then Info = Info & " Prior Page = " & PriorPjcv
a$ = "Enter Page Number Below. "
a$ = a$ & "However, if Front Matter exists, add a space and an offset. "
a$ = a$ & "For example, 7 14 will go to Page 7 after Roman Page XIV. "
a$ = a$ & "To jump by n pages enter +n or -n where n is any number."
sAns = InputBox(a$,"GO TO PAGE " & Info,Def)
If sAns = "" then End
b = split(sAns) : c = b(0) : d = 0
I = Instr("+-",Left(c,1))
If I > 0 then
PlusMinus = true
If I = 1 then c = Mid(c,2) 'Another + sign we need to get rid of.
EndIf
If ubound(b) > 0 then d = b(1)
If Not isNumeric(c) Or Not isNumeric(d) then GoToPage()
c = Cint(c) : d = Cint(d)
If PlusMinus then
p = CurrentP + c + d
Else p = c + d
EndIf
If p < 1 then
MsgBox("There is no page less than 1.",,"Entry Result = " & p)
GoToPage()
EndIf
oVC.jumpToPage(p) 'If beyond end, you get the last page.
PriorPjcv = CurrentP
End Sub
- padmavyuha
*edit* some of the above macro is kind of redundant, and can be trimmed down - but the InputBox() width seems to be a fixed item, there's no way to change the width of the box.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum