Opening Save Changes Dialog VBA

Eyraincg

New Member
Joined
Feb 25, 2014
Messages
1
Hi,

I have written a workbook_beforeclose code that updates another workbook and then change a cell on the workbook with the time updated and lastly opens a msgbox telling the user telling if it has been successfully updated or an error occurred. Currently, the "save changes" dialog would open after the msgbox because one of the cells has been changed. I would like to have the "save changes" dialog appear before running the rest of the code. However, all I could find is how to open the "Save as" dialog which is not what I want.

So my code would look something like this:


Code:
Private Sub workbook_beforeclose(cancel As Boolean)

'open save dialog

If ActiveWorkbook.Saved = True Then
     'run code
     'show msgbox
     activeworkbook.save
End If

activeworkbook.close
End Sub
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.

Forum statistics

Threads
1,215,884
Messages
6,127,563
Members
449,385
Latest member
KMGLarson

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top