Excel VBA won't open PPT files on network drive

261 views Asked by At

I have a very old VBA file that was created by someone else with limited comments to explain it. The file is a training file that asks for names, and then supplies the file names you can view to train in. Variables are passed around from 5 different subroutines.

RetVal = Shell("C:\Program Files\Microsoft Office\OFFICE11\PPTVIEW.EXE  " & ProgFile, 1)

This is the line that opens the PowerPoint 4.0 files from Excel. ProgFile being a passed variable.

My Problem: If I put the files in directory on the C:\ drive (Say C:\Training\Forklift.ppt) the file opens fine and the program does what it is supposed to do.

HOWEVER: Putting those same PPT files on my network Drive (S:\Training\Forklift.ppt) I get three error messages as pop-ups NOT coded into the program (I suspect System errors). (Path names were changed to show as S:\

  1. PowerPoint Viewer Cannot find the File RECORDS
  2. PowerPoint Viewer Cannot find the File Safety
  3. PowerPoint Viewer Cannot find the File Forklift.ppt

RECORDS and Safety are NOT files being used by any of the subroutines. Is it because of the Shell Function to open PowerPoint or some other mystical thing I am overlooking?

I am trying to rewrite the Subroutines and this is part of the unchanged code that is giving me issues.

2

There are 2 answers

0
Sorceri On BEST ANSWER

try surrounding your arg in quotes:

RetVal = Shell("C:\Program Files\Microsoft Office\OFFICE11\PPTVIEW.EXE " & Chr(34) & ProgFile & Chr(34), 1) 
1
FreeMan On

My guess is that RECORDS and Safety are both some sort of external files that are linked in your Forklift.ppt presentation. PowerPoint is notorious for breaking presentations when things get moved. If there are any links in the PPT, they will need to be updated to point to the new location on your S: drive.

You can automate changing the links by writing some VBA code for it, but if this is a one-time move, it's probably not worth it - just redo them by hand.