|First, a posting tip for this forum:|
If you are going to post VBA code, please see this How To for instructions on using the pre tags so that the code is easier for us to read:
OK, I should point out that I don't do much with VBA for PowerPoint; VBA for Excel is where I have most of my expertise. That said, I used some basic VBA debugging techniques, such as Watches and Single Stepping to try an figure out what was going on.
FYI...those techniques are described in detail here:
As I Single Stepped through your original code (via F8) I noticed that the Error handler fired at this line:
If Len(Dir$(sListFilePath & sListFileName)) = 0 Then
When I reviewed that instruction, I noticed that it was using the sListFilePath variable, which your code set to that long string (shortened here so it fits on one line):
sListFilePath = "http://intranet.nrnciss.nato.int/TB/VTC/242%20%....Handout/Week%201/"
Well, I don't have that FilePath on my machine, so I created my own folder and used that path name in the instruction:
sListFilePath = "U:\PPT VBA Test\"
Once I did that, your code ran through to completion, inserting the slides and presenting the "Done" MsgBox.
Based on that result, I have to assume that your long file path string is incorrect. You might try getting rid of the %20's and just using spaces since all you are doing is building is a text string for VBA to use as a file path. Granted, your path is on your Intranet and mine is accessing a networked drive by drive letter, so I can only speculate here.
The other thing I noticed is that you have one spot in your path that shows the %20 twice in a row:
Is that correct? Maybe the %20's are OK to use, but the double %20 would be seen as 2 spaces. Does the FilePath really have 2 spaces after the 242?
I hope something here helps, even if it's just the link to the VBA Debugging tutorial.
Click Here Before Posting Data or VBA Code ---> How To Post Data or Code.