View Single Post
 
Old 06-17-2018, 12:45 AM
trevorc trevorc is offline Windows 7 32bit Office 2013
Competent Performer
 
Join Date: Jan 2017
Posts: 173
trevorc will become famous soon enoughtrevorc will become famous soon enough
Default

Thanks for your idea, I've gone a bit past that now

Code:
        Private Declare PtrSafe Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As LongPtr
    Private Declare PtrSafe Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As LongPtr, ByVal wMsg As Long, ByVal wParam As LongPtr, lParam As Any) As LongPtr
 

Sub Close_Adobe_Reader()
    Const WM_CLOSE = &H10
    Dim strClassName As String
    strClassName = "AcrobatSDIWindow"
    hwnd = FindWindow(strClassName, vbNullString)
    If hwnd Then
        SendMessage hwnd, WM_CLOSE, 0, ByVal 0&
    Else
        MsgBox "Adobe is not running !"
    End If
End Sub

        tt = MsgBox("Select Yes to continue if..." & vbCrLf & vbCrLf & _
                        "The PDF file is correct and has all information" & vbCrLf & _
                        vbCrLf & vbCrLf & _
                        "If you do not want to do this ensure that the PDF file reader is closed then select Cancel and the PDF file will be deleted", vbOKCancel, "Confirmation to Continue ")
            If tt = 2 Then
                Call Close_Adobe_Reader
                Kill (rma_file_name)
                Exit Sub
            Else
            End If
Reply With Quote