Help Please

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

Guest

I have a field on a form called FileLocation. I want to know if I can locate a file by typing in the File path in my File Location field and then to open up the file in what ever the file application is in.
 
Graeme,

If I understand you correctly, you want to launch a file without knowing
which application it belongs to.

http://www.pacificdb.com.au/MVP/Code/ExeFile.htm

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia

Graeme said:
I have a field on a form called FileLocation. I want to know if I can
locate a file by typing in the File path in my File Location field and then
to open up the file in what ever the file application is in.
 
Thanks Graeme R.
How does this code work please

I have put the Public Const code into my Module called Globals
Have made a Public Sub for this code - Public Sub ExecuteFile(sFileName As String, sAction As String

But I do not know where I put the following cod

Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA"
(ByVal hWnd As Long, ByVal lpOperation As String, ByVal lpFile As String,
ByVal lpParameters As String, ByVal lpDirectory As String,
ByVal nShowCmd As Long) As Lon

If you can help, it is much appriciate

Thanks Graem
 
Graeme,

Normally, the whole lot goes into the same module, but if you choose to put
things into different modules, that's perfectly OK. I would recommend you
put the ShellExecute declaration into Globals also.

Call the procedure using the following syntax:
ExecuteFile "path to the file", "Open"

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
 
Back
Top