0

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.

4
  • are the words Record and safety anywhere else in your code? You may need to supply a bigger snippet then the single line. Commented Jun 10, 2015 at 20:24
  • RECORDS and Safety are not in the code anyplace. That is why it is weird that it gives me those errors. I even looked inside the PPT files that the program opens to see if they have VBA in them looking for something else. The PPT files are empty. Commented Jun 10, 2015 at 20:26
  • 2
    try surrounding your arg in quotes: RetVal = Shell("C:\Program Files\Microsoft Office\OFFICE11\PPTVIEW.EXE " & Chr(34) & ProgFile & Chr(34), 1) Commented Jun 10, 2015 at 20:45
  • @Sorceri, write that up as an answer so you can get an upvote! Commented Jun 11, 2015 at 13:05

2 Answers 2

1

try surrounding your arg in quotes:

RetVal = Shell("C:\Program Files\Microsoft Office\OFFICE11\PPTVIEW.EXE " & Chr(34) & ProgFile & Chr(34), 1) 
Sign up to request clarification or add additional context in comments.

Comments

1

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.

1 Comment

'Forklift.ppt' is actually one I JUST made to see if it was an issue with the newer version of PowerPoint. No links in that file at all. It's pristine. One frame, no links and no code.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.