'-- code start --
Public Declare Function FindWindow Lib "user32" Alias _
"FindWindowA" (ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long
Public Declare Function PostMessage Lib "user32" Alias _
"PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, _
ByVal wParam As Long, lParam As Any) As Long
Public Const WM_CLOSE = &H10
Private Sub CloseWindowDown(ByVal vhWnd As Long)
'Author: Duane Hennessy
'Company: Bandicoot Software, Australia
'Date: 4/1/06 5:34 AM
'Description: Actual function that closes the window.
'Dependencies: libraries_etc_here
'Updates: updates_here
'Notes: notes_here
On Error Resume Next
Dim retval As Long
retval = PostMessage(vhWnd, WM_CLOSE, 0&, 0&
End Sub
Public Sub FindAndCloseWindows(Byval window_title as String)
'Author: Duane Hennessy
'Company: Bandicoot Software, Australia
'Date: 4/1/06 5:34 AM
'Description: Find the window by it's title name and close.
'Dependencies: libraries_etc_here
'Updates: updates_here
'Notes: notes_here
On Error Resume Next
Dim window_handle As Long 'Window Handle which will be used to close window.
window_handle = FindWindow(vbNullString, window_title)
If window_handle <> 0 Then
CloseWindowDown (window_handle)
End If
End Sub
'-- code end --
Hope that helps.
Duane Hennessy
Senior Software Engineer and Systems Architect.
Bandicoot Software
Tropical Queensland, Australia
Ph. 00617-3398-6131
(ABN: 33 682 969 957)
Your own personal library of code snippets.
http://www.bandicootsoftware.com.au
--- In AccessDevelopers@yahoogroups.com, "accessrider" <[EMAIL PROTECTED]> wrote:
>
> I have a third party software that prints out an Access report to pdf.
> I name this report on the fly (License No, date, and purpose 1-7).
> Now I am having trouble closing the report using code.
>
> Any suggestions?
> Thanks!
>
>
> Access Rider
>
Please zip all files prior to uploading to Files section.
SPONSORED LINKS
Microsoft access developer | Microsoft access help | Microsoft access database |
Microsoft access training | Microsoft access training course | Microsoft access programming |
YAHOO! GROUPS LINKS
- Visit your group "AccessDevelopers" on the web.
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.