macro conflict when saving

already

Board Regular
Joined
Nov 11, 2008
Messages
179
Hello

When opening my file I went to full screen (sub workbook_open) with a macro and when I close my file I went back to a normal screen also with a macro (BeforeClose)

code = Application.DisplayFullScreen = False or True

When closing the file even when I change nothing in my file the save dialog box appears and this gives me a serious conflict with following
macro (excel and windows crash)

Sub savebutton()
Application.DisplayAlerts = false
ThisWorkbook.Save
Application.DisplayAlerts = True
ThisWorkbook.Close Saved = True
End Sub


How can I work around this?

Thanks in advance for your help

Kind regards
Al
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Code:
Sub savebutton()
Application.DisplayAlerts = false
ThisWorkbook.Save 
Application.DisplayAlerts = True 
ThisWorkbook.Close Saved = True 
End Sub

Why save it twice. If you know it's saved then just close it.

Code:
Sub savebutton()
Application.DisplayAlerts = false
ThisWorkbook.Save 
Application.DisplayAlerts = True 
ThisWorkbook.Close
End Sub
 
Upvote 0
Hi Jproffer

Thanks for your reply

I have disabled the "Application.DisplayFullScreen = False or True
" macro and have used your second macro but excel crashes again.
(but not windows). So it seems not to be a conflict between both macros.
Is it possible that this macro is not compatible with excel 2007?

Kind regards

Al
 
Upvote 0
Hi

I have found out that the 'close' code causes excel to crash but only if
I use a button to run the macro. If I don't use a button and I run the macro via developer > macros > run it works fine.

Strange

Any idea?

Kind regards

Al
 
Upvote 0
If it's an alert causing your crash, then maybe:

Code:
Sub savebutton()
Application.DisplayAlerts = false
ThisWorkbook.Save 
ThisWorkbook.Close
Application.DisplayAlerts = True 
End Sub

Other than that, I'm at a loss but I'm sure there are many people here that will look at this and think "well there's your problem" and point it right out to both of us....I hope anyway.
 
Upvote 0

Forum statistics

Threads
1,214,929
Messages
6,122,315
Members
449,081
Latest member
tanurai

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