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

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
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?
 
Upvote 0
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.
 
Upvote 0
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)
 
Upvote 0
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?
 
Upvote 0
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
 
Upvote 0
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
 
Upvote 0

Forum statistics

Threads
1,214,940
Messages
6,122,356
Members
449,080
Latest member
Armadillos

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
Back
Top