Shell to PowerPoint

chris wood

New Member
Joined
Jun 6, 2003
Messages
27
I am using the code below in an Excel module to try to shell out to the PowerPoint Viewer 2003. However when executing I get the error message: PowerPoint Viewer cannot find the file "Presentation.pps". Does anyone know what I might be missing to enable the viewer to find the file?

Call Shell("C:\PPTVIEW.exe /S Presentation.pps", 1)

I have also tried:

Call Shell("C:\PPTVIEW.exe /S /L playlist.lst", 1)

and get a similar message.

Any help would be greatly appreciated!
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney

chris wood

New Member
Joined
Jun 6, 2003
Messages
27
Thanks for the suggestion Andrew. However, I have tried that too.

What I end up with then is an error message where it thinks the first directory in the path is the file name. So, if the path were C:\My Documents\Presentation.pps I get the error message: PowerPoint Viewer cannot find the file "My".

Any other insights I hope?
 

Seti

Well-known Member
Joined
May 19, 2002
Messages
2,916
Try replacing My Documents with MYDOCU~1. This is the old style naming convention. There is a way to do this with quotes or something, I just don't remember the correct syntax. I think the quotes qould go around the whole directory name and the file. But snce it is enclosed in quotes already, you might have to double up on them like:

Call Shell("C:\PPTVIEW.exe /S ""C:\My Documents\presentation.pps""", 1)

This is untested and probably has bad syntax. Try the short name first to see if at least that works.
 

TommyGun

MrExcel MVP
Joined
Dec 9, 2002
Messages
4,202

ADVERTISEMENT

Seti said:
This is untested and probably has bad syntax. Try the short name first to see if at least that works.

Your syntax is fine, and should correct the users problem without the need for using the short name. Good job. (y)
 

tusharm

MrExcel MVP
Joined
May 28, 2002
Messages
11,029
As Seti pointed out, you need quotes around any 'long name.' The same applies to the program itself. For example, if it were in the Program Files folder in the PPT Viewer subfolder, and not directly in the C drive's root directory, one would use
Code:
Call Shell("""C:\Program Files\PPT Viewer\PPTVIEW.exe"" /S ""C:\My Documents\presentation.pps""", 1)
The above also assumes that the rest of the parameters are correct (i.e., the /s for the PPT Viewer and the 1 for the Shell).
chris wood said:
Thanks for the suggestion Andrew. However, I have tried that too.

What I end up with then is an error message where it thinks the first directory in the path is the file name. So, if the path were C:\My Documents\Presentation.pps I get the error message: PowerPoint Viewer cannot find the file "My".

Any other insights I hope?
 

Ekim

Well-known Member
Joined
Jun 30, 2002
Messages
1,416
I recently had the same problem as the OP. Research on the Net led me to the double quotes. As I understand it, if there is a space in the pathname, e.g. C:\My Documents……..\demo.doc, then “C:\My” is read as one parameter and “Documents\demo.doc” as another.

You don’t need double quotes around the program. This works:
Code:
Sub power()
Dim RetVal

RetVal = Shell("C:\Program Files\Microsoft Office\Office10\Powerpnt ""C:\Documents and Settings\Contract Business\My Documents\General\AAA\Demo_Presentation.ppt""", 1)

End Sub

Regards,

Mike
 

chris wood

New Member
Joined
Jun 6, 2003
Messages
27
It works fine now. Thank you to all who helped me with this. I've been researching a way to run this for days and had just about given up the idea before posting for help here.

This board is fantastic and those who took time to help me are the best!

Chris
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,151,872
Messages
5,766,864
Members
425,382
Latest member
IronM

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top