Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #3  
Old 06-17-2018, 12:45 AM
trevorc trevorc is offline pause VBA code to view PDF file then continue or cancel Windows 7 32bit pause VBA code to view PDF file then continue or cancel Office 2013
Competent Performer
pause VBA code to view PDF file then continue or cancel
 
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
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
What Causes Outlook to Continue Changing File Size While Closed? chasfh Outlook 2 04-14-2018 06:32 AM
pause VBA code to view PDF file then continue or cancel Displaying Code in a task usage view ksa5024 Project 1 06-15-2016 06:15 PM
pause VBA code to view PDF file then continue or cancel Stop macro if no file is selected in dialog box (when user presses cancel instead of selecting file) spencerw.smith Word VBA 2 08-12-2014 07:56 AM
pause VBA code to view PDF file then continue or cancel How to save a PPT file in 'Reading View' to be opened always in 'Reading View' ItzVickey PowerPoint 2 08-08-2012 09:23 AM
pause VBA code to view PDF file then continue or cancel How do you view the source code in a Word 10 web document? provlima Word 2 05-25-2012 01:12 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:27 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft