Run Time Error Method close of object Window Failed

zone709

Well-known Member
Joined
Mar 1, 2016
Messages
2,125
Office Version
  1. 365
Platform
  1. Windows
HI so recently I have this code below which ends my macro. The vba I use below on my computer works fine and closes the active workbook and doesn't save it like its suppose.

On another computer it started to break in red below. I can not figure out why I tried everything. I even removed that line of code and it didn't break, but left the sheet open. Does anyone have an idea why this is happening on another computer, but not mine or maybe a way around it?

Debug message is "Run Time Error -2147417848 (80010108) Method close of object window Failed


Code:
Sub Close10()
Application.DisplayAlerts = False
 Workbooks("Mapping Table.xlsx").Close savechanges:=True
 MsgBox "Fix names in Yellow before running Sheet"
[COLOR=#ff0000] ActiveWindow.Close savechanges:=False  <---------  Debug[/COLOR]
 Application.DisplayAlerts = True
End Sub
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
Re: Run Time Error Methond close of object Window Failed

Try
Code:
ActiveWorkbook.Close False
 
Upvote 0
Re: Run Time Error Methond close of object Window Failed

Thank you this works. I wonder why the activae window stopped working on this computer. puzzling
 
Upvote 0
Re: Run Time Error Methond close of object Window Failed

So this worked for the other sheet like I said, but i noticed after putting in
ActiveWorkbook.Close False.
Why does book1 open afterwards. Something is triggering this. I feel like something changed on excel for some reason and that's what made ActiveWindow.Close savechanges:=False to stop working.
 
Upvote 0
Re: Run Time Error Methond close of object Window Failed

You've probably got some event code in one of the workbooks.
 
Upvote 0
Re: Run Time Error Methond close of object Window Failed

i actually do, but didnt thikn it was this because i never had an issue and always worked for me.

Code:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
If Workbooks.Count = 2 Then
    Me.Saved = True
    Workbooks("Personal.xlsb").Saved = True
    With Application
        .DisplayAlerts = False
        .Quit
    End With
Else
    Me.Close False
End If
End Sub
 
Upvote 0
Re: Run Time Error Methond close of object Window Failed

That doesn't open any workbooks, so there must be something else.
 
Upvote 0
Re: Run Time Error Methond close of object Window Failed

ok thanks for the reply i am still gonna keep testing it and play the macro till something clicks in my mind what can it be.
 
Upvote 0

Forum statistics

Threads
1,223,894
Messages
6,175,250
Members
452,623
Latest member
Techenthusiast

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