application.followhyperlink vs ShellExecute API

  • Thread starter Thread starter LSDean
  • Start date Start date
L

LSDean

The application.followhyperlink yields the Run timer Error 16388 which
is caused by either security settings or anti-virus software.
Selecting OK makes message vanish and the hyperlink executes properly.
The clicking OK is annoying.

Found numerous posts by Dirk and Dev to use API calls. I implemented
the code, but now I get a different run time error:

Run time error 438
Object doesn't support this property or method.

The hyperlink leads to a TIF. Below is the code. I'm showing example
of each approach.

Any suggestions on how to avoid these errors?

' = = = = = = = =
Private Sub cmdHyperFront_Click()
Dim xfile As String

' xserver is \\server1\folder1\subfolder1\
' xserver ends with backslash

xfile = xserver & Trim([box]) & _
"\lowres\" & Trim([Negative]) & "\" & _
Trim([Negative]) & "r.tif"

If IsFile(xfile) = True Then
'Application.FollowHyperlink xfile
Print fHandleFile(xfile, WIN_NORMAL)
' fhandlefile cause Run time error 438
Else
xfile = xserver & _
Trim([Negative]) & "\" & _
Trim([Negative]) & "r.tif"
If IsFile(xfile) = True Then
Application.FollowHyperlink xfile
' application.followhyperlink causes
' run time error 16388
'Print fHandleFile(xfile, WIN_NORMAL)
Else
MsgBox "Image does not exist.", vbOKOnly
End If

End If

End Sub
' = = = = = =

Thank you,
LSDean
 
LSDean said:
The application.followhyperlink yields the Run timer Error 16388 which
is caused by either security settings or anti-virus software.
Selecting OK makes message vanish and the hyperlink executes properly.
The clicking OK is annoying.

Found numerous posts by Dirk and Dev to use API calls. I implemented
the code, but now I get a different run time error:

Run time error 438
Object doesn't support this property or method.

The hyperlink leads to a TIF. Below is the code. I'm showing example
of each approach.

Any suggestions on how to avoid these errors?

' = = = = = = = =
Private Sub cmdHyperFront_Click()
Dim xfile As String

' xserver is \\server1\folder1\subfolder1\
' xserver ends with backslash

xfile = xserver & Trim([box]) & _
"\lowres\" & Trim([Negative]) & "\" & _
Trim([Negative]) & "r.tif"

If IsFile(xfile) = True Then
'Application.FollowHyperlink xfile
Print fHandleFile(xfile, WIN_NORMAL)
' fhandlefile cause Run time error 438
Else
xfile = xserver & _
Trim([Negative]) & "\" & _
Trim([Negative]) & "r.tif"
If IsFile(xfile) = True Then
Application.FollowHyperlink xfile
' application.followhyperlink causes
' run time error 16388
'Print fHandleFile(xfile, WIN_NORMAL)
Else
MsgBox "Image does not exist.", vbOKOnly
End If

End If

End Sub
' = = = = = =

Thank you,
LSDean

Assuming you got the code for fHandleFile from The Access Web, I don't
think it's the function that is giving you the error. It may be the use
of the Print statement, though. Did you really want to print the result
somewhere? What happens if you replace this line:
Print fHandleFile(xfile, WIN_NORMAL)

with this:

fHandleFile xfile, WIN_NORMAL

?
 
I found the error ---

Print fHandleFile(xfile, WIN_NORMAL)

should have been

Call fHandleFile(xfile, WIN_NORMAL)

Everything is working well.

LSDean
 
Back
Top