Check out this link , it shows how to call a macro from Excel. This could give you an idea how to do it in powerpoint.
http://support.microsoft.c
Main Topics
Browse All TopicsI need to control power point from a VB5 exe file. 2 things I need to do are load and run a slide show presentation, which I have achieved by doing the following. This works nicely.
Set mypres = GetObject("c:\testrun.pps"
mypres.application.Visible
With mypres.SlideShowSettings
.LoopUntilStopped = True
.Run
End With
I also need to be able to call either a form or macro written in VBA (office 97), in the same powerpoint presentation.
How do I load a form or call a sub in powerpoint from VB5.
I can access the application and presentation objects using the above method, but it fails when I try and call a form or macro. The problem to me is that maybe they somehow need to be declared as objects, that are then available as "automation" objects from VB.
Any help would be appreciated
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Check out this link , it shows how to call a macro from Excel. This could give you an idea how to do it in powerpoint.
http://support.microsoft.c
Thanks for the comments Gents, but still no luck.
I have tried the following as a result of the link supplied by Marine.
Sub main()
Dim mypres As Object
Set mypres = GetObject("c:\testrun.ppt"
'open the presentation
mypres.Application.Visible
'Run the slideshow
With mypres.SlideShowSettings
.LoopUntilStopped = True
.Run
End With
'run the macro
mypres.Application.Run "calledsub"
End Sub
This opens, and runs the presentation, but when it gets to the line """"" mypres.Application.Run "calledsub" """"""" it comes up with a error "Invalid request, sub or function not defined". However the sub is there and I can call it within powerpoint by using the same line from within another powerpoint sub. So for some reason this is still not available as as automation object externally to powerpoint.
Any further clues ??
Azrasound, thanks for the reference, but I have already gone through this section.
Same problem again "application.run, sub or function not defined". I tried the following.
I put an object on a slide and associated the mouse click event with the sub.
Dim mypres As Object
Set mypres = GetObject("c:\testrun.ppt"
'open the presentation
mypres.Application.Visible
'Run the slideshow
With mypres.SlideShowSettings
.LoopUntilStopped = True
.Run
End With
############
With mypres.Application.ActiveP
.ActionSettings.Applicatio
End With
##########
The lines between the #### work within powerpoint only, but in vb it gives the error as above.
There is something basic that we are missing. (Isn't it always the case !!!)
A workaround probably, check your code below, I've inserted a dummy statement which will make the macro run successfully :
Sub main()
Dim mypres As Object
Dim tempstr as String 'dummy string variable
Set mypres = GetObject("c:\testrun.ppt"
'open the presentation
mypres.Application.Visible
'Run the slideshow
With mypres.SlideShowSettings
.LoopUntilStopped = True
.Run
End With
'I've inserted the dummy statement before calling the macro, see explanation below.
tempstr = mypres.Application.ActiveP
'run the macro
mypres.Application.Run "calledsub"
End Sub
What I observed is that referring either the VBE object or VBProject somehow makes the macros run. I guess there should be a proper way of initializing the VBProject object.
In the mean time, you can insert a statement similar to the one I've given above to make it work.
Let me know if you still get the error.
Hi Gnome42,
I've tested this without any problem. The "solver" came from including the persentation file name and the module name in which the sub resides.
Sub TestPP()
Dim mypres As PowerPoint.Presentation
Set mypres = GetObject("c:\testrun.ppt"
'open the presentation
mypres.Application.Visible
'Run the slideshow
With mypres.SlideShowSettings
.LoopUntilStopped = True
.Run
End With
'############
With mypres
.Application.Run "Testrun.ppt!Module1.calle
End With
'##########
End Sub
Good Luck
Calacuccia
Sgovinda and Calacuccia,
My apologies, i got sent out on site and was unable to try this until this evening.
You are both legends in my book !!.
They both work, Nice to know there is people out there willing to help an "unknowledgable soul" like myself.
Not sure what happens to the points as I think they shold be split between you . Or maybe there is a rule that the 1st correct answer wins. Either way I have increased the points to 350, so that if it can be split, you can get a better deal out of the split. How you do this I am unsure, maybe you know a friendly administrator than can sort this out.
Thanks again
Sgovinda and Calacuccia,
My apologies, i got sent out on site and was unable to try this until this evening.
You are both legends in my book !!.
They both work, Nice to know there is people out there willing to help an "unknowledgable soul" like myself.
Not sure what happens to the points as I think they shold be split between you . Or maybe there is a rule that the 1st correct answer wins. Either way I have increased the points to 350, so that if it can be split, you can get a better deal out of the split. How you do this I am unsure, maybe you know a friendly administrator than can sort this out.
Thanks again
My Pleasure, Gnome42.
Just wanted to tell you that there is a way to split points but you have to post a separate question for the 2nd (and 3rd...) expert just entitled 'For ExpertNme' assigned with the points you want to assign. In this case you could for example have assigned the 250 points to Svoginda and have opened a special question for me, worth 100 pts, or you could have asked to community support (link on bottom of page) to split the points equally.
I don't want you to do this for now, you've alreay spent plenty for this question, so you better keep your points for next time ;-)
And after all, Svoginda was the first to find a solution.
Cheers
Calacuccia
Business Accounts
Answer for Membership
by: AzraSoundPosted on 2000-05-28 at 19:47:45ID: 2857014
http://www.microsoft.com/o fficedev/a rticles/Op g/006/006. htm