PowerPoint VBA Shell problem

N

Nickooo87

Hello,

Ive currently got a proble using the shell function to open an exe
file in VBA powerpoint. I have been using the below code:

Sub CreateMenuRibbon(control As IRibbonControl)
Shell ("prjwWebbrowser.exe")
End Sub

As the exe file was in the same directory as the powerpoint file it
opened fine on click of my custom ribbon button. However 2 days ago it
suddenly stopped working and is giving me runtime error 53 file not
found. It will now only work if i give it the full path of where the
file is. However this i cant do as this is a piece of software that is
to be downloaded offline and i need it to just find the file as being
in the same directory as the powerpoint,

does anyone know of a way that i can get it to open without giving the
full path length? as it is a downloaded piece of software the path
will be diferent on each computer downloaded to so i need to trap it
to just the file it is contained in!

Any ideas?

Really appreciate any help anyone can give

thank you sooo much in advance

Nick
 
K

Karl E. Peterson

Nickooo87 said:
Hello,

Ive currently got a proble using the shell function to open an exe
file in VBA powerpoint. I have been using the below code:

Sub CreateMenuRibbon(control As IRibbonControl)
Shell ("prjwWebbrowser.exe")
End Sub

As the exe file was in the same directory as the powerpoint file it
opened fine on click of my custom ribbon button. However 2 days ago it
suddenly stopped working and is giving me runtime error 53 file not
found. It will now only work if i give it the full path of where the
file is. However this i cant do as this is a piece of software that is
to be downloaded offline and i need it to just find the file as being
in the same directory as the powerpoint,

does anyone know of a way that i can get it to open without giving the
full path length? as it is a downloaded piece of software the path
will be diferent on each computer downloaded to so i need to trap it
to just the file it is contained in!

Any ideas?

Dim PptPath As String
PptPath = ActivePresentation.Path
If Right$(PptPath, 1) <> "\" Then PptPath = PptPath & "\"
Shell PptPath & "prjwWebbrowser.exe"

The bizness with the trailing backslash is in case the presentation
ends up stored in the root folder of some drive. Otherwise that
property will pretty much never have it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top