Expand|Select|Wrap|Line Numbers
- Print fHandleFile(app_path + "\shb.pdf", WIN_NORMAL)
Expand|Select|Wrap|Line Numbers
- Function fHandleFile(stFile As String, lShowHow As Long)
- Dim lRet As Long, varTaskID As Variant
- Dim stRet As String
- Dim Vresponse As String
- 'First try ShellExecute
- lRet = apiShellExecute(hWndAccessApp, vbNullString, _
- stFile, vbNullString, vbNullString, lShowHow)
- If lRet > ERROR_SUCCESS Then
- stRet = vbNullString
- lRet = -1
- Else
- Select Case lRet
- Case ERROR_SUCCESS:
- varTaskID = Shell("rundll32.exe shell32.dll,OpenAs_RunDLL " _
- & stFile, WIN_NORMAL)
- lRet = (varTaskID <> 0)
- Case ERROR_NO_ASSOC:
- 'Try the OpenWith dialog
- varTaskID = Shell("rundll32.exe shell32.dll,OpenAs_RunDLL " _
- & stFile, WIN_NORMAL)
- lRet = (varTaskID <> 0)
- Case ERROR_OUT_OF_MEM:
- stRet = "Error: Out of Memory/Resources. Couldn't Execute!"
- Case ERROR_FILE_NOT_FOUND:
- stRet = "Error: Adobe acrobat reader not installed. Couldn't Execute!"
- Case ERROR_PATH_NOT_FOUND:
- stRet = "Error: Path not found. Couldn't Execute!"
- Case ERROR_BAD_FORMAT:
- stRet = "Error: Bad File Format. Couldn't Execute!"
- Case Else:
- End Select
- End If
- fHandleFile = lRet & IIf(stRet = "", vbNullString, ", " & stRet)
- If fHandleFile = -1 Then
- Else
- Vresponse = MsgBox(fHandleFile, vbOKOnly, "" & VMsgtitle & "")
- End If
- End Function
I've tried using the Application.followhyperlink method but that give me a security error, that comes from Microsoft office "Opening shb.pdf Some files can contain viruses or otherwise e harmful to your computer. It is important to be certain that this file is from a trustworthy source. Would you like to open this file?"
I know this file if safe and is part of my application so I don't want that to show.
Either method is fine with me if I can figure out a way to do away with the error 438 or eliminate the security warming.
Any help is always appreciated.
Thanks