Solved

Problems with powerpoint vba initialising APP

Posted on 2013-11-25
3
651 Views
Last Modified: 2013-11-25
I have tried to follow the guidance provided on the Microsoft website for event handling but i can not get the following to code work.

I have a classmodule called "EventClassModule" - includes the following code

Public WithEvents App As PowerPoint.Application

Private Sub App_PresentationOpen(ByVal Pres As Presentation)
    ActivePresentation.Slides(12).Shapes("TextBox1").OLEFormat.Object.Text = "Basic introduction to training"
End Sub

I have a module called "Module1" includes the follwoing code

Dim X As New EventClassModule
Sub InitializeApp()
    Set X.App = PowerPoint.Application
End Sub

And i was hoping that when i open the ppt file the text box on page12, textbox1 will be populated but it simply does not work and does not error.

I am obviously doing something very stupid (like where and how do i run initializeapp), all help most welcome
0
Comment
Question by:SweetingA
3 Comments
 
LVL 49

Accepted Solution

by:
Rgonzo1971 earned 500 total points
ID: 39673996
Hi

the code InitialzeApp

Sub InitializeApp()
    Set X.App = PowerPoint.Application
End Sub

Open in new window


Doesn't fire itself

you have to have an autoopen in an ppt File saved as add-in to do it (ppta) and the rest of your class module code

Dim X As New EventClassModule

Sub Auto_Open() 
     Set X.App = PowerPoint.Application
End Sub 

Open in new window

Regards
0
 

Author Comment

by:SweetingA
ID: 39674726
Hello there,

sorry i am a real dummy and a new starter to this.

Can you explain the procedure right from the start as i may have other things set wrong.

Sorry to be a pest.

Thanks
0
 
LVL 23

Expert Comment

by:JSRWilson
ID: 39674800
Rgonzo is telling you (correctly) that it is very difficult  to fire the sub to initialise the event object from a normal presentation. The only reliable sub that fires is Auto_Open BUT it will only fire when an ADDIN loads. The ADDIN cannot contain your slides.

If this is a pptm file AND you are sure the user is opening in edit mode and Macro security is set low enough you can use the ribbon onLoad Event from XML. You may not even need the class module.

There's a simple tutorial on how to add this XML to the presentation.

http://www.pptalchemy.co.uk/PowerPoint_Auto_Open_Code.html

In the presentation


Sub OnLoadCode()
   ActivePresentation.Slides(12).Shapes("TextBox1").OLEFormat.Object.Text = "Basic introduction to training"
End Sub

If you can wait for the show to begin before changing the ActivX text then it is easier!

Probably good to explain WHY the text has to be changed too.
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Search Form with Run Time Error 3075 1 23
MS Access Tables Linking 6 42
Access 2010 Query Syntax 5 23
MS Access VBA Print PDF just Current Page 9 12
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Technology opened people to different means of presenting information, but PowerPoint remains to be above competition. Know why PPT still works today.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now