Solved

VB Script to launch powerpoint presentation

Posted on 2009-04-02
2
1,051 Views
Last Modified: 2012-08-13
I ceated the follwing scrip to launch a powerpoint presentation for our marketing display workstations on startup by placing this script file into the startup group.  The problem is that the file name migh change so i was thinking of using the follwoing line for line 3 of the code Set Pres = PPT.Presentations.Open("C:\Test\*.ppt") but this fails.  Is there a way to run this sayingopen only the ppt presentation in the specifed folder.  We will only have one presentation in the folder at a time.
Set PPT = CreateObject("PowerPoint.Application")

PPT.Visible=True

Set Pres = PPT.Presentations.Open("C:\Test\Test.ppt")

Open in new window

0
Comment
Question by:georgedschneider
2 Comments
 
LVL 8

Assisted Solution

by:jwarnken
jwarnken earned 250 total points
Comment Utility
This will work as long as there is only one ppt file in the folder
Dim fso, presFiles

presFolder = "C:\Test"

Set fso = CreateObject("Scripting.FileSystemObject")

Set presFiles = fso.GetFolder(presFolder)

For Each f In presFiles.Files 

	If Right(LCase(f.Name),3) = "ppt"Then presFile = f.Path

Next 

WScript.Echo presFile

Open in new window

0
 

Accepted Solution

by:
georgedschneider earned 0 total points
Comment Utility
I added your script wiht the one i had previosuly to create the script below making it a little bit more dynamic by reading all fiels fin a folder for the one powerpoint presentation that needs to run.
Set objFSO = CreateObject("Scripting.FileSystemObject")

Set PPT = CreateObject("PowerPoint.Application")

objStartFolder = "C:\Test"

Set objFolder = objFSO.GetFolder(objStartFolder)

Set colFiles = objFolder.Files

For Each objFile in colFiles

	If objfile.type = "Microsoft PowerPoint Presentation" then

	PPT.Visible=True

	Set Pres = PPT.Presentations.Open("C:\Test\Test.ppt")

	End If	

Next

Open in new window

0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Script to copy or move mouse-selected collection of files plus targets referenced by shortcuts (.lnk) The purpose of this article is to help illuminate the real challenges and options available (where they may exist) for utilizing simple scriptin…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

763 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

7 Experts available now in Live!

Get 1:1 Help Now