Powerpoint : What is the event fired after transitioned to the next slide? - vba

Powerpoint has an event SlideShowNextSlide which is triggered just before the slide show transitioned to the next slide.
What is the event that is triggered after the slide show has transitioned to the next slide?

You'll want to bookmark this page from Chirag Dalal:
http://www.officeoneonline.com/vba/events_version.html
I'm not sure that the specific event you're looking for exists.
But something like this might do the job:
Sub OnSlideShowPageChange(ByVal Wn As SlideShowWindow)
MsgBox Wn.View.Slide.SlideIndex
End Sub
This event fires during a slide show when the slide changes to either next slide or previous slide.

Related

Powerpoint VBA: Restart each slide

We are building a kiosk. Each slide has a video. Whenever the user navigates or returns to a slide, the video should restart. I have vba code that does this but on 1st run, powerpoint doesn't appear to run the vba. Is there some sort of intialize module I need to add?
Only code:
Public Sub OnSlideShowPageChange(ByVal Wn As SlideShowWindow)
ActivePresentation.SlideShowWindow.View.ResetSlideTime
End Sub

How to set scrollTop on each tab in a Multipage UserForm?

I've figured out how to set the ScrollTop in UserForm_Initialize() however I can't work out how you can set an event on each time a user flicks between a tab/page in a Multipage.
Does MS Word VBA not have a similar function to UserForm_Initialize() or UserForm_Activate() for when a tab/page is changed?
My issue is even though I have ScrollTop = 0 in UserForm_Initialize(), when the user swaps to a new tab/page the focus is changed to focus on the top control (textbox) and the ScrollTop is no longer 0. So I need to reset it.
Found the answer.
Word VBA has a multipage function you can use to determine when a user enters a new page/tab.
For example:
Private Sub MultiPage1_Change()
Me.ScrollTop = 0
End Sub
You would add this to your UserForm module.

Run Worksheet_Open code with a userform active

My program calls 7 subroutines in the workbook_open event. I want to show a progress bar (with a 'Done' button when the progress is 100%) but when I show the progress bar, it doesn't run the workbook_open event anymore until I close the userform, then it goes on running. Is there a way to show a userform with the code running in the background?
Private Sub Workbook_Open()
frmProgress.Show
'Here it stops running the code
frmProgress.lblTask = "Updating pivottables..."
Call updatePivots
ufProgress.Label1.BackColor = &H8000000D
frmProgress.lblTask = "Updating data..."
Call updateData
ufProgress.Label2.BackColor = &H8000000D
'Some More code
frmProgress.lblTask = "Done!"
End Sub
I know the changing of the colors and the multiple labels are not efficient, I'm working on that.
You should put the code in the UseForm Activate event handler which would trigger on Workbook Open event handler :)

Context Menu - Hide all buttons and add my buttons only

I am looking for a way to hide all the buttons from the Excel context menu and just leave my buttons I created.
How can I do that?
I found a way to do this, When i got same problem..
If you want to remove any item
Sub RemoveItems()
Application.CommandBars("Cell").Controls("Insert...").Delete
Application.CommandBars("Cell").Controls("Cut").Delete
Application.CommandBars("Cell").Controls("Copy").Delete
End Sub
Or if you want to delete all items then
Sub DeleteAll()
Set CtrlMenu = Application.CommandBars("Cell")
For Each Item In CtrlMenu.Controls
Item.Delete
Next
End Sub
If you want to restore again
Sub ResetMenu()
Application.CommandBars("Cell").Reset
End Sub

How to remove black borders from spin button

In trying to remove black border from spin button onclick
(btw, I'm very interesting about the reasons for this ugly black border)
Private Sub spin01_SpinUp()
... //some code
ch01.SetFocus // ch01 is a textbox
First click - there are no borders
Next click - borders are there
Next click - there are no borders - and so on
The same is for SpinDown()
Very strange, isn't it?
Those black borders are to let you know the spin button currently has focus. If you click on the textbox ch01 on your userform, then the lines will go away. AFAIK there isn't any property to remove those Black Borders permanently.
What is happening in your case is the code transfers the focus to the textbox ch01 and that is when you do not see the borders but when the focus comes back to the Spin Button, those black borders are back.
Alternative:
Use Two command buttons and replicate the functionality of the Spin Button. You can also change the .Picture to show arrows instead of text on the command button. See Screenshot Below
FOLLOWUP
Private Sub spin01_SpinUp()
'
'~~> Rest of the code
'
wait 0.1
ch01.SetFocus
End Sub
Private Sub spin01_SpinDown()
'
'~~> Rest of the code
'
wait 0.1
ch01.SetFocus
End Sub
Public Sub wait(ByVal nsec As Double)
nsec = nsec + Timer
While nsec > Timer
DoEvents
Wend
End Sub