Jump to content
Sign in to follow this  

Prompting user to save work before something is installed...and more

Recommended Posts


What I'm trying to do is alert a user pc of an application upgrade.  Its just a simple exe that im storing on the users c: drive.  The user needs to close excel before it can run.  I have tried creating a small gui that allows them to postpone for up to 20 minutes, etc and got down to checking if the process exists, and apparently the function before it doesnt work. So im a bit stuck. 


Global $intCount = 0
Global $intCount1 = 0

; Alert users of upgrade
Func _DelayedInstall
    $intRemain = 3 - $intCount1
    $guiMain = GUICreate("Upgrade", 350, 150, -1, -1, -1)
    GUICtrlCreateLabel("An add-in update is available. Please close Excel and click install when you are ready.", 25, 20, 310, 60)
    GUICtrlCreateLabel("NOTE:  Clicking the 'X' will cause the install to postpone for 20 minutes", 25, 55, 310, 20)
    $objButtonCont = GUICtrlCreateButton("Install", 82, 90, 70, 20)
    $objButtonDelay = GUICtrlCreateButton("Postpone", 197, 90, 70, 20)
    GUICtrlCreateLabel("You may delay this install for 20 minutes, up to " & $intRemain & " more times.", 40, 125, 310, 20)

; If install postponed 3 times, no longer option
    If $intCount = 3 Then
        GUICtrlSetState($objButtonDelay, $guiDisable)


While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $objButtonCont ; restart if they hit restart
        Case $guiEventClose ; proceed with install if they close message box without selecting option
            $intCount1 += 1
        Case $objButtonDelay ; they delayed reboot - allows them to save open work in Excel
            $intCount1 += 1

; Check for any open occurrences of excel
If ProcessExists("EXCEL.EXE") Then
    MsgBox("0", "", "You are receiving an add-in update and Excel is open.  Please save Excel worksheets and close.  If this dialog box is closed before closing Excel, Excel will be closed automatically.")

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this