Code to bypass Msgbox Help

Excelnoobisme

Board Regular
Joined
Nov 19, 2010
Messages
128
Hi,

i have a worksheet "A" with msgbox popup when i attempt to close it.

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim Response As Long

Response = MsgBox("Have you save a copy?", vbYesNo)
If Response = vbNo Then
Cancel = True
Else: ThisWorkbook.Saved = True
End If
End Sub


On worksheet "B" i have some link to Worksheet "A", and when i try to
Windows("A").close, it will show the above MsgBox. Is there any code to bypass it?
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Not sure exactly what you are asking about.

First, I suspect by "worksheet" you really mean workbook. If that's the case, please clarify if you are asking to not have the message box appear if you quit Excel (close all workbooks). I mention that because you referenced closing Windows. Otherwise it's a mystery what you are talking about.
 
Upvote 0
Yes tom, i mean workbook. Im asking to not have the message box appear if i quit Excel (close all workbooks).But im not going to delete the code as it will serve the purpose for people working on that workbook alone.

I just wanted to bypass that msgbox alert if i close it after i transfering some data and when attempting to close it via vba
 
Upvote 0

Forum statistics

Threads
1,224,596
Messages
6,179,807
Members
452,944
Latest member
2558216095

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