Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How do i open up a new PP presentation from template file from Windows using VBA

Posted on 2012-03-18
3
Medium Priority
?
329 Views
Last Modified: 2012-03-25
Hi!

I have managed to open a PPT file using  the Shell and the run command.

" objShell = CreateObject("Wscript.Shell") "

But the problem is that it opens up the template itself, and it doesn't understand that it is supposed to generate a new document from the template when it opens up PowerPoint?
0
Comment
Question by:Musiqal
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 59

Accepted Solution

by:
Chris Bottomley earned 2000 total points
ID: 37736498
Try the following ... but modify the template string as appropriate.  I have shown two methods for adding a slide ... one direct and one to a variable ... the choice of which to use is yours.  The fist slide not surprisingly has to be '1' but after that change the first parameter to the add command to represent the slide to be added i.we. 1 adds as the first slide, 3 adds as the third slide BUT must never exceed the current number of slides by more than 1:

Sub presNew()
Dim pptApp As Object
Dim pres As Object
Dim strTemplate As String
Dim sld As Object
Const ppLayoutFourObjects As Integer = 24
Const ppLayoutTitle As Integer = 1

    strTemplate = "C:\Program Files\Microsoft Office\Templates\Presentation Designs\cliff.pot"
    Set pptApp = CreateObject("powerpoint.application")
    With pptApp.Presentations.Open(strTemplate, False, True, True)
                'Add slides as required ... i.e.
        .slides.Add 1, ppLayoutFourObjects
        Set sld = .slides.Add(1, ppLayoutTitle)
        sld.Shapes(1).TextFrame.textrange.Text = "I'm NEW!"
    End With

End Sub

Open in new window

0
 

Author Comment

by:Musiqal
ID: 37751403
This would have been great, but the problem is the slides need to be there from the beginning, any ideas?
0
 
LVL 59

Expert Comment

by:Chris Bottomley
ID: 37751771
If the slides exist in the template then they ought to be there ... the extra code supplied was to show how to add additional slides to the file derived from the template.

Chris
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Meetings to discuss business process can waste time, and often do .  The meeting's dialog can get confusing when participants have different professional perspectives and backgrounds.  A jointly-developed process picture helps wade through the confu…
When asking a question in a forum or creating documentation, screenshots are vital tools that can convey a lot more information and save you and your reader a lot of time
The viewer will learn how to make their project stand out over others by learning how to change colors and shapes, add spaces, change directions, and add bullets to their charts.
An overview on how to enroll an hourly employee into the employee database and how to give them access into the clock in terminal.

609 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