SelfTaughtVBA
MIS
As the last remaining feature to include before publishing an .xls file for colleagues to use, I would love to learn how to show a warning message if the following macro (yes, I did find the basic gist for it via Google) fails to find the expected document:
General Declarations bit...
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Sub OpenPPT()
Dim PPT_Doc As String
PPT_Doc = ActiveWorkbook.Path & "\" & "Trends.ppt"
ShellExecute 0, "open", PPT_Doc, vbNullString, vbNullString, 5
End Sub
This macro is called from a button, and at the moment if the document doesn't exist then no clue is given to the User other than "nothing happening".
I have checked whether Err holds a value to see if I can use that in an IF clause, but it doesn't (well, it's zero whether a Powerpoint document is found to open or not).
My handle tells all that I am doing this for fun to solve a MIS need but am by no means a VBA pro; Learning VBA has become a drug though, so having failed to solve the problem myself I would love to learn from someone else.
Grateful thanks.
General Declarations bit...
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Sub OpenPPT()
Dim PPT_Doc As String
PPT_Doc = ActiveWorkbook.Path & "\" & "Trends.ppt"
ShellExecute 0, "open", PPT_Doc, vbNullString, vbNullString, 5
End Sub
This macro is called from a button, and at the moment if the document doesn't exist then no clue is given to the User other than "nothing happening".
I have checked whether Err holds a value to see if I can use that in an IF clause, but it doesn't (well, it's zero whether a Powerpoint document is found to open or not).
My handle tells all that I am doing this for fun to solve a MIS need but am by no means a VBA pro; Learning VBA has become a drug though, so having failed to solve the problem myself I would love to learn from someone else.
Grateful thanks.