Thomas
asked on
How to open/run Windows Snipping Tool from Access vba?
I want to open/run the Windows 10 snipping tool from Access vba code. The code below produces the error "Windows cannot find 'C:\Windows\System32\Snipp ingTool.ex e' ". Of course the exe file is in that location. Outside of Access, the snipping tool runs as expected. Any ideas? Thanks.
Private Sub cmdSnippingTool_Click()
Dim strProgramPath As String
Dim lngResult As EnumShellExecuteErrors
Dim ShellExecute As New CShellExecute
lngResult = seeNoError
strProgramPath = "C:\Windows\System32\Snipp ingTool.ex e"
Set ShellExecute = New CShellExecute
lngResult = ShellExecute.LaunchProgram (strProgra mPath, , , sesSW_SHOWMAXIMIZED)
If lngResult <> seeNoError Then
MsgBox "Error on LaunchDocument: " & lngResult
End If
Set ShellExecute = Nothing
End Sub
Private Sub cmdSnippingTool_Click()
Dim strProgramPath As String
Dim lngResult As EnumShellExecuteErrors
Dim ShellExecute As New CShellExecute
lngResult = seeNoError
strProgramPath = "C:\Windows\System32\Snipp
Set ShellExecute = New CShellExecute
lngResult = ShellExecute.LaunchProgram
If lngResult <> seeNoError Then
MsgBox "Error on LaunchDocument: " & lngResult
End If
Set ShellExecute = Nothing
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Works perfectly. Thanks to both MASQ and Joe Winograd.
You're welcome, Thomas, very glad to hear that it works for you. Regards, Joe
Change the full path to this:
C:\Windows\Sysnative\Snipp
Btw, documented a couple of years ago in this EE thread:
https://www.experts-exchange.com/questions/29003803/Restore-Windows-7-Snipping-Tool-function-to-Windows-10.html
Regards, Joe