[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Close named powerpoint presentation in vba

Posted on 2014-03-06
12
Medium Priority
?
3,203 Views
Last Modified: 2014-03-06
I have two powerpoint presenatations open.

I want to close only one of them.

I used application.quit but it closed all as it closes powerpoint.

I therefore used Application.ActivePresentation.Close which works but leaves the window open so i can't see my other ppt presenatation below.

All help most welcome.
0
Comment
Question by:SweetingA
[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
  • 6
  • 4
  • 2
12 Comments
 
LVL 23

Expert Comment

by:JSRWilson
ID: 39908944
Not completely clear what you need but supposing you want to close the presentation named "control.pptx" and minimize PPt

Presentations("control.pptx").Close
Application.WindowState = ppWindowMinimized
0
 
LVL 53

Expert Comment

by:Rgonzo1971
ID: 39908957
Hi,

pls try

'Application.Presentations("c:\Documents\Presentation4.pptx").Close or
Application.ActivePresentation.Close
Application.ActiveWindow.Activate

Open in new window

Regards
0
 
LVL 23

Expert Comment

by:JSRWilson
ID: 39909010
I misread!

You really need to say what version of Office as versions before 2010 act differently

In all cases though the other presentaion should show I think unless you are running the code from the vb editor.
0
Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

 

Author Comment

by:SweetingA
ID: 39909119
I am using ppt2010
0
 

Author Comment

by:SweetingA
ID: 39909132
JSRWilson, your solution did not work as window is not minimised
0
 

Author Comment

by:SweetingA
ID: 39909148
Rgonzo1971, same as JRWilson, closes presentation show but does not close or minimise active window
0
 

Author Comment

by:SweetingA
ID: 39909151
What i am doing is running several ppsm presentations from a common dashboard and i intended to leave the dashboard open and just bring the ppsm's to the front and close them on exit.

It works fine except the ppsm window stays on the screen with the dashboard hidden behind it.
0
 
LVL 23

Expert Comment

by:JSRWilson
ID: 39909197
You need to explain exactly what you are doing. Starting with how you made the Dashboared and what it does. Are the ppsm opening in show mode and how are you opening and closing them.
0
 

Author Comment

by:SweetingA
ID: 39909264
The dashboard is just a page of buttons, i run it from a batch file at startup, its a ppsm file

Under each button is a simple code see attached to run various presnetations

Me.CommandButton7.Caption = "Introducing" & vbNewLine & "GMP"
Me.CommandButton7.Font.Size = 10

Dim pptPres As PowerPoint.Presentation
Dim pptApp As PowerPoint.Application
Dim pptSlide As PowerPoint.Slide
Dim file As String

file = "f:\Users\Training\GMPRefresher.ppsm"

Set pptApp = CreateObject("PowerPoint.Application")
pptApp.Visible = True
Set pptPres = pptApp.Presentations.Open(FileName:=file)

At the end of any presenatation, i instruct the user to press a button which should close the current presnetation and window so that the dashboard returns to the screen.

At the moment the presenation closes, but an instance of powerpoint remains open so i can see the development window in front of the dashboard.

If i use application.quit it closes all instances of ppt so i loose the dahsboard completely.
0
 
LVL 53

Expert Comment

by:Rgonzo1971
ID: 39909279
Hi,

Have you tried

Set pptApp = Nothing

Open in new window


Regards
0
 
LVL 23

Accepted Solution

by:
JSRWilson earned 2000 total points
ID: 39909534
Try this to open

Dim pptPres As Presentation
Dim file As String
file = "C:\Users\John\Desktop\test.ppsm"
Set pptPres = Presentations.Open(FileName:=file, withwindow:=False)
pptPres.SlideShowSettings.Run

Open in new window


And this to close

SlideShowWindows(1).View.Exit

Open in new window

0
 

Author Comment

by:SweetingA
ID: 39909606
JSR Wilson - You are a genius. thank you very much
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Setting the Scene Animations in PowerPoint are a great tool to convey messages when used carefuly with the content of your slides. There are plenty of animation effects and options, including a Repeat feature for individual animation effects. …
Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
This video teaches viewers how to fit pictures into slides, crop and remove backgrounds, and alter photos to look more professional.
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…

656 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