FollowHyperlink generates error 490

K

Ken Warthen

I'm using the following code to open selected files that are double clicked
in a listview control on an Access 2007 form. I get an error #490 that says
"Cannot open the specified file." I can't figure out why this is happening.
I could swear this code was working last week without any problems. Any help
or advice will be greatly appreciated. — Ken

Set lvxObjFile = Me.lvwDocuments.Object
strSelectedDocument = lvxObjFile.SelectedItem
intSelectedIndex = lvxObjFile.SelectedItem.Index

' If the double clicked file is an email (.msg)
' Check to insure Outlook is opened. If not, open it.
Select Case right(strSelectedDocument, 3)
Case "msg"
Set objOutlook = GetObject(, "Outlook.Application")
If objOutlook Is Nothing Then
Box "Outlook is not running.\nStart Outlook and then double
click on message name.", vbOKOnly + vbInformation, "Outlook Status"
Else
strDoc = strPath & "\" & strSelectedDocument
Application.FollowHyperlink strDoc, , NewWindow:=True
End If
Case Else
strDoc = strPath & "\" & strSelectedDocument
Application.FollowHyperlink strDoc, , NewWindow:=True
End Select
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top