How can I write code to open file ?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

In my form. I choose button wizard then select run application, If I select
file by .exe such as msword.exe, acrobat.exe it can open that application
file, but if select such as aaa.doc or bbb.pdf it cannot open file. How can I
open it?

in event procedure I see call shell(file name and path)

if file name is .exe.it can open
if not .exe then can not open
 
Insert the following into the "on click" event (or where ever). "[File]" is
the field and "Qry_filetype" is the table or query.

Dim varURL As Variant

varURL = DLookup("[File]", "Qry_FileType")

If IsNull(varURL) Then
MsgBox "Sorry, this document does not exist!", vbOKOnly + vbInformation
Else
Application.FollowHyperlink varURL
End If

End Sub
 
Back
Top