Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Bypass hyperlink prompt in VBA?

34 views
Skip to first unread message

Robert Bonds

unread,
Mar 28, 2010, 8:54:01 PM3/28/10
to
Am having a bit of a problem with the following line of VBA code activated
from a command button on a form I've designed in Access 2007:

Application.FollowHyperlink Me.DocumentFilePath

This works fine when the file being opened is a PDF, Excel file, Word
document, etc. But when the file to be opened is a saved e-mail message (.msg
file), a prompt always pops up: "Some files can contain viruses or otherwise
be 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?"

Any e-mail messages being opened this way will always be from trustworthy
sources, and will already have been screened for viruses. So I'm wondering if
there's a way to bypass this prompt? It appears to be coming from outside
Access, since inserting a "DoCmd.SetWarnings False" line just before the
above code has no effect.

Any suggestions would be greatly appreciated. Thanks.

Arvin Meyer [MVP]

unread,
Mar 28, 2010, 9:23:50 PM3/28/10
to
I'm not sure if this would work, but it does intercept other Outlook
security measures:

http://www.dimastr.com/redemption
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.accessmvp.com
http://www.mvps.org/access


"Robert Bonds" <Rober...@discussions.microsoft.com> wrote in message
news:9ECAE0BE-EAB6-45B3...@microsoft.com...

Allen Browne

unread,
Mar 28, 2010, 9:29:58 PM3/28/10
to
You may be able to avoid the issue by using a complete hyperlink (with the
file prefix and both the display and address parts.)

This kind of thing:

Dim strDoc As String
strDoc = "file:///" & Me.DocumentFilePath & "#" & Me.DocumentFilePath
FollowHyperlink strDoc


--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.


"Robert Bonds" <Rober...@discussions.microsoft.com> wrote in message
news:9ECAE0BE-EAB6-45B3...@microsoft.com...

Jack Leach

unread,
Mar 29, 2010, 5:23:01 AM3/29/10
to
Application.FollowHyperlink has this downfall, being that the OS opens the
file as if you found it on the web somewhere. Instead, try the ShellExecute
API. I've never opened a .msg file with it, but for every other filetype
where a security prompt is present using FollowHyperlink, the API will open
it wthout warning.

http://www.mvps.org/access/api/api0018.htm


hth

--
Jack Leach
www.tristatemachine.com

"I haven''t failed, I''ve found ten thousand ways that don''t work."
-Thomas Edison (1847-1931)

Robert Bonds

unread,
Mar 29, 2010, 10:01:01 PM3/29/10
to
Jack, the ShellExecute API does the job. It works perfectly! Thanks for the
tip.

Allen, thanks for the suggestion regarding the complete hyperlink. It didn't
work in this case, but I can already think of other areas where it will come
in handy, so am glad to have your feedback.

Arvin, thanks too for telling me about Outlook Redemption. Since the
ShellExecute API worked in this limited case, I haven't explored this plug-in
yet, but it looks like it could well provide an answer to the next 937
problems on my list! So am very glad to know about this – thanks much.

Robert Bonds

======

0 new messages