Shell & Opening a PowerPoint Doc

Keesw

New member
Local time
Today, 14:51
Joined
Apr 4, 2004
Messages
5
All,

I have a button on a form which, when clicked, I want to open a PowerPoint document for the user to view.

The code I have is :

Private Sub Command45_Click()
Dim stAppName As String, stFile As String
Dim strQ As String

strQ = Chr$(34)

'Set the location of your executable
stAppName = strQ & "C:\Program Files\Microsoft Office\Office10\powerpnt.exe " & strQ
'Set the location of your target file
stFile = strQ & "Z:\Houfile047\ESG\Procurement\LensProj\ProLog Implementation Project\Procurement\Strategic Sourcing\Savings Tracking\Calculators and Plug n Plays\Price Scales" & strQ
Call Shell(stAppName & " " & stFile, 1)
End Sub

When I run this I get a message that "PowerPoint was unable to open or save this document. Please ensure that you have access priviliges to read or write the document and that it is not encrypted"

I should have the required priviliges as I am able to navigate to and open the PPT fine if I use something like explorer.

Any got ideas as to what the problem may be ?

TIA
 
Duhhh

I found the problem. I had the path to the file but not the actual file name !.
 
Just curious, why not just...
Code:
Private Sub Command1_Click()
    strHLINK = "Z:\Houfile047\ESG\Procurement\LensProj\ProLog Implementation Project\Procurement\Strategic Sourcing\Savings Tracking\Calculators and Plug n Plays\Price Scales\FileName.ppt" 
    Application.FollowHyperlink strHLINK
    
End Sub
 
WHy Not

Thanks for the suggestion. I am not at all familiar with VBA and just hunted around for a solution which would work. I used what I found....and now that it is working, I am loath to change it !
 

Users who are viewing this thread

Back
Top Bottom