Running Excel VBA in Powerpoint

rikapple

New Member
Joined
Feb 17, 2014
Messages
45
I have a Macro with 2 buttons. Ideally I am looking to run this Macro within PowerPoint.

PowerPoint is just to run a video in the background with the Macro on top. I have that part working , but I am unable to get the macro to run correctly or the buttons to work correctly.

Is there anything I need to do to ensure this works?

Many thanks in advance

Steph
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
Public Stopflag As Boolean
Sub runnum()
Do While Not (Stopflag)
Range("F4") = Range("f4") + 1
If Range("f4") > 2000 Then Range("F4") = 0
' call your subroutine here instead of the last two lines of code
DoEvents
Loop

End Sub

Sub Stoprun()
Stopflag = True
End Sub
Sub Startrun()
Stopflag = False
Call runnum
End Sub
 
Upvote 0
Well, these statements are excel-specific, so they will not run on Powerpoint:

VBA Code:
Range("F4") = Range("f4") + 1
If Range("f4") > 2000 Then Range("F4") = 0
you could try this:

VBA Code:
Sub runnum()
dim i as Long
Do While Not (Stopflag)
i = i + 1
If i > 2000 Then i = 0
' call your subroutine here instead of the last two lines of code
DoEvents
Loop

End Sub
 
Upvote 0
This is the file I have so far, all I am trying to achieve is have the names rotating around on the first button press and then stop on the second press. The issue I am also having is the excel sheet will not display until after I exit the presentation. I would like the randomised names showing when the start button is pressed.

I have it working in Excel and everything is the same so unsure what has gone wrong. Any comments much appreciated.

Link Here is a link to my file

Kind regards

Stephanie
 
Last edited:
Upvote 0
Well, for one, there is no code behind the two buttons so it makes perfect sense that nothing is happening. Also, where would these names you want to display come from? They are not in the powerpoint file apparently.
 
Upvote 0
Well, for one, there is no code behind the two buttons so it makes perfect sense that nothing is happening. Also, where would these names you want to display come from? They are not in the powerpoint file apparently.
The excel sheet page 1. It displays page 2. That's why I am asking for help!
 
Upvote 0
I have working code, but it isn't very reliable when in presentation mode. See the OneDrive folder.
 
Upvote 0

Forum statistics

Threads
1,215,150
Messages
6,123,312
Members
449,094
Latest member
Chestertim

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top