Excel closes automatically

WxShady13

Board Regular
Joined
Jul 24, 2018
Messages
73
I have a new desktop computer and since I started using it any Excel file with a macro will run the script and then just close Excel. There are no errors, nor does it matter which Excel workbook I use. These previously worked fine on a different computer, and other colleagues are able to use the files as they always have. Is there a setting on my new computer or do I need to run Office Repair?
 

BlakeSkate

Well-known Member
Joined
Jan 26, 2015
Messages
500
Office Version
2016
Platform
Windows
any Excel file with a macro will run the script and then just close Excel.
is there a personal workbook macro?
can you post an example of any code you are running?
 

WxShady13

Board Regular
Joined
Jul 24, 2018
Messages
73
is there a personal workbook macro?
can you post an example of any code you are running?
The macro's are only used specifically for the workbooks and they are all different in each workbook. Each workbook that I have tried has unique macro's and the code is different.
 

BlakeSkate

Well-known Member
Joined
Jan 26, 2015
Messages
500
Office Version
2016
Platform
Windows
okay well no on can help you if you don't give more information

perhaps include: your version of excel/office, what version of windows you are using, if these are fresh installations or the computer came with them.
an example of a code you run that closes excel.
or perhaps you have a personal macro workbook you didn't know you had that has a sheet enabled vba code or similar function
you can check here on how to find it

or you can just run office repair :rolleyes: and pray that it solves your problem
 

WxShady13

Board Regular
Joined
Jul 24, 2018
Messages
73
I am using Office 365 Excel

Here s an example of the first macro that is launched.

Code:
Sub CopyTable()
Application.ScreenUpdating = False
Sheets("SHMM Sections").Unprotect Password:="-----"
'Worksheets("SHMM Sections").Range("A3:CS200").ClearContents
With Worksheets("SHMM Sections").ListObjects("Table4")
        If Not .DataBodyRange Is Nothing Then
            .DataBodyRange.Delete
        End If
    End With

Dim LastRow As Long
LastRow = Range("A" & Rows.Count).End(xlUp).Row
Call CBTModuleClear
Worksheets("Sign-In Sheet").Range("A7:D" & LastRow).Copy
Worksheets("SHMM Sections").Range("A3:CS" & LastRow).PasteSpecial xlPasteValues
Worksheets("CBT Modules").Range("A2:D" & LastRow).PasteSpecial xlPasteValues
'Worksheets("SHMM Sections").Range("A3").PasteSpecial = xlPasteValues
Call IFStatements
Call CBTIfStatements
Sheets("SHMM Sections").Protect Password:="-------"
Application.ScreenUpdating = True
End Sub
Thiscode sta
 

BlakeSkate

Well-known Member
Joined
Jan 26, 2015
Messages
500
Office Version
2016
Platform
Windows
I am using Office 365 Excel

Here s an example of the first macro that is launched.
if this first macro exits excel then go through your macros
"CBTModuleClear, IFStatements, and CBTIfStatements
and check for the keywords using the ctrl + f find function
".Quit" , "Application", ".Close"

note that case sensisitvity and whole word only should be unchecked.
you can also check the "Current Project" search radio button

try also looking in your microsoft excel objects > ThisWorkbook as well as microsoft excel objects > Sheet(whichever one is relevant) in the Microsoft Visual Basic editor screen
any codes there?

also any update on if you have a macro workbook?
 
Last edited:

WxShady13

Board Regular
Joined
Jul 24, 2018
Messages
73
It is saved as a macro workbook (.xlsm)

Thank you let me go check the code.
 

WxShady13

Board Regular
Joined
Jul 24, 2018
Messages
73
I went through the workbook & macros and there is no code telling it to close. Also on all the other machines it does not close automatically.
 

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
51,135
Office Version
365
Platform
Windows
You still haven't answered BlakeSkate's question about whether or not you have a Personal Macro Workbook on your computer.
These macros would NOT be found in the workbook you are talking about, but would be available to you at all times when you have Excel open.
See: https://trumpexcel.com/person-macro-workbook/

The easiest way to see if you do is to close out of all open Excel workbooks, except for this one that you are working on.
Then, go into the VB Editor, and bring up the Project Explorer (View -> Project Explorer).
How many VBAProjects does it show? Does it list one named VBAProject (PERSONAL.XLSB)?
 

BlakeSkate

Well-known Member
Joined
Jan 26, 2015
Messages
500
Office Version
2016
Platform
Windows
the only thing i can think of BESIDES a personal macro workbook is if you have an an excel addin that is corrupt. You could try to uninstall and reinstalling any addons you have installed to this pc.
 

Forum statistics

Threads
1,077,822
Messages
5,336,564
Members
399,088
Latest member
Swindlestikz

Some videos you may like

This Week's Hot Topics

Top