Brian,
 
    If you are using FollowHyperlink method, it means full path of target file is directly available to you. In that case, ShellExecute API call, with appropriate arguments is to be preferred as it is quicker in opening the document in maximized mode and is free from warning dialog boxes encountered with some types of files while using FollowHyperlink method.
 
    Sample code is given below. If you feel it necessary to see its use in a db, both the alternatives (ShellExecute as well as FollowHyperlink) are demonstrated in my sample db named PrintExternalFiles. It is available at Rogers Access Library (other developers library). Link - http://www.rogersaccesslibrary.com
 
Best wishes,
A.D.Tejpal
 
Form's Code Module
==================================
' General Declaration Section (at top)
Private 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 Long
-------------------------------------------------------------
 
' Click event of command button
Private Sub CmdOpenDoc_Click()
    Call ShellExecute(0, "Open", FilePath, "", "", 3)
End Sub
==================================
 
----- Original Message -----
Sent: Tuesday, June 14, 2005 18:23
Subject: [AccessDevelopers] Re: Maximize Adobe Reader Window opened by clicking hyperlink in Access

Thanks for the response A.D.  My program has them clicking a button and using the FollowHyperlink method.  I'm sort of a novice at coding, at least I've never done anything like this before, could you help me with an example of what you mentioned with the delay loop and the WithEvents statement.

Thanks again,

Brian Stenglein


--- In [email protected], "A.D.Tejpal" <[EMAIL PROTECTED]...>
wrote:
> Brian,
>
>     For ensuring that documents opened by clicking a hyperlink
control on the form, get displayed in maximized state, we have to
allow for the time delay involved in activation and stabilization of
the target document.
>
>     When FollowHyperlink method of access application, based upon
path of target document is used (instead of direct hyperlink), the
required time lag can be accommodated in the click event itself,
using a suitable time delay loop incorporating WithEvents statement.
>
>     The alternative mentioned in previous para is not available
when clicking hyperlink type control. Execution of code in click
event precedes activation of hyperlink. In such a situation, the
desired objective can be achieved by transient activation / de-
activation of form's timer. Sample code for form's module, as given
below, should get you the desired results.
>
>     It may please be ensured that [Event Procedure] appears on
Event tab of the properties dialog box of the form (against the item:
On Tmer) as well as TxtLinkDoc (against the item: On Click).
>
> Best wishes,
> A.D.Tejpal
>
> Form's VBA Module
> (TxtLinkDoc is the name of hyperlink type control)
> ====================================
> ' General Declarations Section
> ' Global variables
> Private Hwd As Long, TotTime As Long
> ' Set max limit for time out = 10 seconds
> Private Const MaxTime As Long = 10000
>
> ' API declarations
> Private Declare Function GetForegroundWindow _
>                                             Lib "user32" () As Long
> Private Declare Function ShowWindow _
>                         Lib "user32" (ByVal hwnd As Long, _
>                         ByVal nCmdShow As Long) As Long
> ----------------------------------------------------------------
> Private Sub Form_Timer()
>     Dim HwDoc As Long
>    
>     TotTime = TotTime + Me.TimerInterval
>     If TotTime > MaxTime Then   ' Time out
>         Me.TimerInterval = 0
>         Exit Sub
>     End If
>    
>     HwDoc = GetForegroundWindow()
>     If HwDoc <> Hwd Then
>         ShowWindow HwDoc, 3   ' 3 for maximized state
>         Me.TimerInterval = 0
>     End If
> End Sub
>
> Private Sub TxtLinkDoc_Click()
>     TotTime = 0
>     Hwd = Application.hWndAccessApp
>     Me.TimerInterval = 200
> End Sub
> ====================================
>
>   ----- Original Message -----
>   From: Brian Stenglein
>   To: [email protected]
>   Sent: Friday, June 10, 2005 21:43
>   Subject: [AccessDevelopers] Maximize Adobe Reader Window opened
by clicking hyperlink in Access
>
>
>   I have an Access DB with a bunch of searchable topic names and
each topic has a corresponding hyperlink to a pdf file.  One minor
annoyance my users are complaining about is that the Adobe window
that opens when they click the hyperlink is always rather small and
they have to maximize the window every time.  Is there a way I can
force that window to open maximized?
>
>   Thanks,
>
>   Brian Stenglein



Please zip all files prior to uploading to Files section.




Yahoo! Groups Links

Reply via email to