[AccessD] Opening Other Program Files

Andy Lacey andy at minstersystems.co.uk
Tue Nov 8 01:47:17 CST 2005


Sorry David. Here's ShellExecute

Declare Function ShellExecute Lib "shell32" 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 Long


Private Const InadequateMemory = 0
Private Const FileNotFound = 2
Private Const PathNotFound = 3
Private Const BadFormat = 11
Private Const NotRegistered = 31
Private Const Success = 32

I think that's the lot.

-- Andy Lacey
http://www.minstersystems.co.uk 



> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com 
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of 
> David Emerson
> Sent: 07 November 2005 23:05
> To: Access Developers discussion and problem solving
> Subject: Re: [AccessD] Opening Other Program Files
> 
> 
> Thanks Andy,
> 
> Also, You have a number of variables that are not declared 
> (especially in the case statement).  Do you have the values for these?
> 
> David
> 
> At 8/11/2005, you wrote:
> >Hi David
> >Sounds like you want RunApp. See fn below. I'm afraid I don't recall 
> >who to credit. Just call RunApp passing it the filename. 
> Don't recall 
> >when you need the 2nd param but I alwys pass a value of 1 
> and it works 
> >fine.
> >
> >Function RunApp(strFile As String, bytSize) As Boolean
> >     Dim lngRet As Long
> >     Dim varTaskID As Variant
> >     Dim strRet As String
> >
> >     lngRet = ShellExecute(hWndAccessApp, vbNullString, strFile,
> > vbNullString, vbNullString, bytSize)
> >     If lngRet > Success Then
> >         strRet = vbNullString
> >         lngRet = -1
> >         RunApp = True
> >     Else
> >         RunApp = False
> >         Select Case lngRet
> >             Case NotRegistered
> >                 varTaskID = Shell("rundll32.exe 
> > shell32.dll,OpenAs_RunDLL " & strFile, bytSize)
> >                 lngRet = (varTaskID <> 0)
> >             Case InadequateMemory
> >                 MsgBox "Error:  Out of Memory/Resources!"
> >             Case FileNotFound
> >                 MsgBox "Error:  File not found!"
> >             Case PathNotFound
> >                 MsgBox "Error:  Path not found!"
> >             Case BadFormat
> >                 MsgBox "Error:  Bad File Format!"
> >             Case 5
> >                 MsgBox "Error:  Unauthorized due to 
> Security restrictions!"
> >         End Select
> >     End If
> >End Function
> >
> >
> >HTH
> >-- Andy Lacey
> >http://www.minstersystems.co.uk
> >
> > > -----Original Message-----
> > > From: accessd-bounces at databaseadvisors.com
> > > [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of David 
> > > Emerson
> > > Sent: 07 November 2005 22:17
> > > To: accessd at databaseadvisors.com
> > > Subject: [AccessD] Opening Other Program Files
> > >
> > >
> > > I have a field that has the full path to a file.  The 
> file may be a 
> > > pdf or word doc.  My user would like to be able to 
> doubleclick the 
> > > field and have the correct application open with the file 
> (eg double 
> > > click on a pdf will open Acrobat with the file showing).
> > >
> > > Any pointers on how this can be done?
> 
> -- 
> AccessD mailing list
> AccessD at databaseadvisors.com 
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
> 
> 




More information about the AccessD mailing list