VBA to close workbook only closes a partial part of it

ipbr21054

Well-known Member
Joined
Nov 16, 2010
Messages
5,226
Office Version
  1. 2007
Platform
  1. Windows
Afternoon,

Within my code i am using this line of code to close the workbook.

Rich (BB code):
    End With
    Sheet8.Range("A8") = "BAR CODE 1"
    Sheet8.Range("Q8") = "BAR CODE 1"
    Sheet8.Range("A12") = "BAR CODE 2"
    Sheet8.Range("Q12") = "BAR CODE 2"
    Sheet8.Range("A16") = "BAR CODE 3"
    Sheet8.Range("Q16") = "BAR CODE 3"
    Sheet8.Range("A20") = "BAR CODE 4"
    Sheet8.Range("Q20") = "BAR CODE 4"

    ActiveWorkbook.Save
    Application.ScreenUpdating = True
    ActiveWorkbook.Close True
    
End Sub

The issue is that it doesnt close ALL the workbook so i can then see example my desktop.
It say only closes a partial part of it "not explained enough"

I am able to still see The Ribbon thus still having to click the x in the top right corner.

See screen shot of what happens when code is run.
 

Attachments

  • 960.jpg
    960.jpg
    45.1 KB · Views: 4

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
what if you replace
ActiveWorkbook.Close True
with
Application.Quit
 
Upvote 0
That then just gives me another RTE and another line of code is selected
 
Upvote 0
Here

Rich (BB code):
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rng As Range, c As Range
Set rng = Intersect(Target, Range("P6:U6"))
If Not rng Is Nothing Then
    Application.EnableEvents = False
    For Each c In rng
        If Not c.HasFormula Then c.Value = UCase(c.Value)
    Next c
    Application.EnableEvents = True
End If
End Sub
 
Upvote 0
I am afraid, I don't see any relation between your intial code and your last code.

Do you have only one workbook open or more when trying to close the excel application ?
 
Upvote 0

Forum statistics

Threads
1,214,943
Messages
6,122,380
Members
449,080
Latest member
Armadillos

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