Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Microsoft Access > Re: Files launc...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 10 of 11 Topic 30191 of 31596
Post > Topic >>

Re: Files launched w/ Followhyperlink open but not visible

by Ruben <rubenfmunoz@[EMAIL PROTECTED] > May 9, 2008 at 08:55 AM

On May 9, 5:13=A0am, "paii, Ron" <n...@[EMAIL PROTECTED]
> wrote:
> "Ruben" <rubenfmu...@[EMAIL PROTECTED]
> wrote in message
>
> news:5091c851-aaf6-41ba-9417-975d4951df3a@[EMAIL PROTECTED]
> On May 8, 1:21 pm, "paii, Ron" <n...@[EMAIL PROTECTED]
> wrote:
>
>
>
>
>
> > "Ruben" <rubenfmu...@[EMAIL PROTECTED]
> wrote in message
>
>
>news:877e8375-e061-44fd-8849-90bb86bd759e@[EMAIL PROTECTED]
>
> > > Hello,
>
> > > I am using the "Application.FollowHyperlink strFilePath, , True"
line
> > > of code from within access forms to launch any file type I want
(e.g.,=

> > > xls, doc, pdf, etc.). The files open up okay, but open up in the
> > > background. How do I make them open in front where they are visible?
> > > I have tried various things like "Appliction.Visible=3DTrue / False"
> > > and "Screen.ActiveControl.Visible=3DTrue / False" but have not been
ab=
le
> > > to figure it out.
>
> > > Anyones help with this would be very much appreciated.
>
> > > Regards,
>
> > > Ruben Munoz
>
> > I have been using the following code to open any type of do***ent with
a=
n
> > associated program
>
> > '************ Code Start **********
> > ' This code was originally written by Dev A****sh.
> > ' It is not to be altered or distributed,
> > ' except as part of an application.
> > ' You are free to use it in any application,
> > ' provided the copyright notice is left unchanged.
> > '
> > ' Code Courtesy of
> > ' Dev A****sh
> > '
> > Private Declare Function apiShellExecute 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 Long
>
> > '***App Window Constants***
> > Public Const WIN_NORMAL =3D 1 'Open Normal
> > Public Const WIN_MAX =3D 3 'Open Maximized
> > Public Const WIN_MIN =3D 2 'Open Minimized
>
> > '***Error Codes***
> > Private Const ERROR_SUCCESS =3D 32&
> > Private Const ERROR_NO_ASSOC =3D 31&
> > Private Const ERROR_OUT_OF_MEM =3D 0&
> > Private Const ERROR_FILE_NOT_FOUND =3D 2&
> > Private Const ERROR_PATH_NOT_FOUND =3D 3&
> > Private Const ERROR_BAD_FORMAT =3D 11&
>
> > '***************Usage Examples***********************
> > 'Open a folder: ?fHandleFile("C:\TEMP\",WIN_NORMAL)
> > 'Call Email app: ?fHandleFile("mailto:das...@[EMAIL PROTECTED]
",WIN_NORMAL)
> > 'Open URL: ?fHandleFile("http://home.att.net/~da****sh",
WIN_NORMAL)
> > 'Handle Unknown extensions (call Open With Dialog):
> > ' ?fHandleFile("C:\TEMP\TestThis",Win_Normal)
> > 'Start Access instance:
> > ' ?fHandleFile("I:\mdbs\CodeNStuff.mdb", Win_NORMAL)
> > '****************************************************
>
> > Function fHandleFile(stFile As String, lShowHow As Long)
> > Dim lRet As Long, varTaskID As Variant
> > Dim stRet As String
> > 'First try ShellExecute
> > lRet =3D apiShellExecute(hWndAccessApp, vbNullString, _
> > stFile, vbNullString, vbNullString, lShowHow)
>
> > If lRet > ERROR_SUCCESS Then
> > stRet =3D vbNullString
> > lRet =3D -1
> > Else
> > Select Case lRet
> > Case ERROR_NO_ASSOC:
> > 'Try the OpenWith dialog
> > varTaskID =3D Shell("rundll32.exe shell32.dll,OpenAs_RunDLL "
> > _
> > & stFile, WIN_NORMAL)
> > lRet =3D (varTaskID <> 0)
> > Case ERROR_OUT_OF_MEM:
> > stRet =3D "Error: Out of Memory/Resources. Couldn't Execute!"
> > Case ERROR_FILE_NOT_FOUND:
> > stRet =3D "Error: File not found. Couldn't Execute!"
> > Case ERROR_PATH_NOT_FOUND:
> > stRet =3D "Error: Path not found. Couldn't Execute!"
> > Case ERROR_BAD_FORMAT:
> > stRet =3D "Error: Bad File Format. Couldn't Execute!"
> > Case Else:
> > End Select
> > End If
> > fHandleFile =3D lRet & _
> > IIf(stRet =3D "", vbNullString, ", " & stRet)
> > End Function
> > '************ Code End **********
>
> Ron,
>
> Thanks very much for the sample code provided. =A0The ShellExecute part
> of the code work great! =A0Is there any way to redirect the focus to
> access upon closing the external file just launched? =A0Otherwise, I can
> certainly work with this.
>
> Ruben
>
> Glad the code helped.
> The ShellExecute function returns after attempting to open the file with
> success or fail. At that point your Access application has no control
over=

> the shelled application. Maybe check with the "Dev A****sh" who
originally
> posted the code, maybe there is a shell api that will wait for the
shelled=

> to application to close.- Hide quoted text -
>
> - Show quoted text -

Ron,

Thanks again for your help on this.  It gives something more to work
with.

Regards,

Ruben
 




 11 Posts in Topic:
Files launched w/ Followhyperlink open but not visible
Ruben <rubenfmunoz@[EM  2008-05-07 17:23:01 
Re: Files launched w/ Followhyperlink open but not visible
kaisersose1995 <kaiser  2008-05-08 02:24:47 
Re: Files launched w/ Followhyperlink open but not visible
Ruben <rubenfmunoz@[EM  2008-05-08 10:50:53 
Re: Files launched w/ Followhyperlink open but not visible
"Larry Linson"   2008-05-08 18:26:13 
Re: Files launched w/ Followhyperlink open but not visible
Ruben <rubenfmunoz@[EM  2008-05-08 11:50:07 
Re: Files launched w/ Followhyperlink open but not visible
"Larry Linson"   2008-05-09 00:15:03 
Re: Files launched w/ Followhyperlink open but not visible
"paii, Ron" <  2008-05-08 15:21:48 
Re: Files launched w/ Followhyperlink open but not visible
Ruben <rubenfmunoz@[EM  2008-05-08 15:19:52 
Re: Files launched w/ Followhyperlink open but not visible
"paii, Ron" <  2008-05-09 07:13:41 
Re: Files launched w/ Followhyperlink open but not visible
Ruben <rubenfmunoz@[EM  2008-05-09 08:55:25 
Re: Files launched w/ Followhyperlink open but not visible
Ruben <rubenfmunoz@[EM  2008-05-09 10:12:46 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Dec 5 11:50:27 CST 2008.