Mrrrr's Forum (VIEW ONLY)
Un forum care ofera solutii pentru unele probleme legate in general de PC. Pe langa solutii, aici puteti gasi si alte lucruri interesante // A forum that offers solutions to some PC related issues. Besides these, here you can find more interesting stuff.
Lista Forumurilor Pe Tematici
Mrrrr's Forum (VIEW ONLY) | Reguli | Inregistrare | Login

POZE MRRRR'S FORUM (VIEW ONLY)

Nu sunteti logat.
Nou pe simpatie:
PussyKat
Femeie
19 ani
Bucuresti
cauta Barbat
27 - 53 ani
Mrrrr's Forum (VIEW ONLY) / Tutoriale si Ghiduri Utile // Tutorials and useful guides / [POWERPOINT] Go To Slide Number with CTRL+G in Editing Mode Moderat de TRaP, TonyTzu
Autor
Mesaj Pagini: 1
TRaP
Moderator

Inregistrat: acum 7 ani
Postari: 822
Powerpoint offers the option to navigate to slide number only in presentation mode. While in that mode, you type the page number and press enter to go to it.

While you can navigate by entering presentation mode (F5 or SHIFT+F5), typing slide number, pressing ENTER, pressing ESC to exit presentation mode, it is kind of annoying to navigate like this. What if you type a different page number by mistake? You would either have to go there manually or do the previously mentioned process again.

The code below requires AutoHotkey:

#IfWinActive ahk_class PPTFrameClass
^G::
    InputBox, UserInput, Go to Slide Number, Please enter a slide number:, , 200, 150
    if (ErrorLevel) ; user cancelled
        return
    Send, {F5}
    Sleep, 100
    Send, %UserInput%
    Send, {Enter}
    Sleep, 250
    Send, {Esc}
return
#IfWinActive


This does the same steps mentioned above (F5, slide number, ENTER, ESC), but automatically.

This is different from the code from source link because newer PowerPoint versions (e.g., 365) don't have the word "PowerPoint" in the window name. Otherwise, the code is basically the same except for the 1st line.

Source for final AutoHotkey code:
ChatGPT

Original source for ideas and AutoHotkey code:


pus acum 2 zile
   
TRaP
Moderator

Inregistrat: acum 7 ani
Postari: 822
VBA Alternative - but in order to add button to QAT for quick Alt+number access, you must create a custom ribbon.


Sub JumpToSlideNumber()
    Dim slideNumber As String
    slideNumber = InputBox("Enter slide number to go to:")
   
    If IsNumeric(slideNumber) Then
        ActiveWindow.View.GotoSlide CLng(slideNumber)
    End If
End Sub


Untested.

Source:
ChatGPT


pus acum 2 zile
   
TRaP
Moderator

Inregistrat: acum 7 ani
Postari: 822
A tad more complicated code that ensures the input box stays open when pressing OK and navigating, so that you can use it without having to press CTRL+G every time. The input box closes when Cancel or X is pressed.


#IfWinActive ahk_class PPTFrameClass
^G::
    GoSub, ShowInputBox
return

ShowInputBox:
    Gui, New, +AlwaysOnTop +HwndMyGuiHwnd, Go to Slide Number
    Gui, Add, Text,, Please enter a slide number:
    Gui, Add, Edit, vSlideInput w200
    Gui, Add, Button, x10 y+10 w80 gSubmitSlide Default, OK    ; Gui, Add, Button, Default gSubmitSlide, OK
    Gui, Add, Button, x+10 yp w80 gCancelInputBox, Cancel    ; Gui, Add, Button, gCancelInputBox, Cancel
    Gui, Show,, Go to Slide Number
return

SubmitSlide:
    Gui, Submit
    if (SlideInput = "") {
        MsgBox, 48, Input Needed, Please enter a slide number.
        return
    }
    Gui, Destroy

    ; Re-activate PowerPoint before sending keystrokes
    WinActivate, ahk_class PPTFrameClass
    Sleep, 200

    ; Jump to the slide via Slideshow mode and then exit
    Send, {F5}
    Sleep, 200
    Send, %SlideInput%
    Send, {Enter}
    Sleep, 300
    Send, {Esc}
return

CancelInputBox:
    Gui, Destroy
return


Source:
ChatGPT


pus acum 2 zile
   
TRaP
Moderator

Inregistrat: acum 7 ani
Postari: 822
Similar approach with VBA that does not go through Slideshow mode.

You must create custom User Form and save a custom ribbon to load with PowerPoint (as Add-in).

Untested.

Insert → UserForm → Name it frmGoToSlide

Add:

- Label: “Please enter a slide number:”

- TextBox: named txtSlide

- An OK Button: named btnOK

- Cancel Button: named btnCancel

Code for UserForm:


Private Sub btnOK_Click()
    Dim slideNum As Integer
    On Error GoTo InvalidInput
    slideNum = CInt(Me.txtSlide.Text)
   
    If slideNum >= 1 And slideNum <= ActivePresentation.Slides.Count Then
        ActiveWindow.View.GotoSlide slideNum
    Else
        MsgBox "Slide number out of range.", vbExclamation
        Exit Sub
    End If
   
    Exit Sub
   
InvalidInput:
    MsgBox "Please enter a valid slide number.", vbExclamation
End Sub

Private Sub btnCancel_Click()
    Unload Me
End Sub

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
    If CloseMode = vbFormControlMenu Then ' X button clicked
        Unload Me
    End If
End Sub


Code for Module:


Sub ShowGoToSlideBox()
    frmGoToSlide.Show vbModeless ' <== This makes it non-blocking (you can still edit slides)
End Sub


Source:
ChatGPT


pus acum 2 zile
   
Pagini: 1  

Mergi la