I'm using the following at one bit:
I have 10 of the following:
Workbooks.Open Filename:="" & RAWDATALOCATION & "\main.xlsx"
Windows("main.xlsx").Close SaveChanges:=False
I have 1 of the following, next two code examples use this same file so it only closes later on
Dim wbList As Workbook: Set wbList = ActiveWorkbook
Dim wbData As Workbook: Set wbData = Workbooks.Open(Filename:="C:\file.xlsm")
Set wbList = Nothing
Set wbData = Nothing
I have 6 of the following
Dim wbDest As Workbook: Set wbDest = ActiveWorkbook
Set wbSource = Workbooks("file.xlsm")
Set wbSource = Nothing
Set wbDest = Nothing
I have 1 of the following (it closes the file from above that stays open through 5 macros)
Dim wbDest As Workbook: Set wbDest = ActiveWorkbook
Set wbSource = Workbooks("file.xlsm")
wbSource.Close SaveChanges:=False
Set wbSource = Nothing
Set wbDest = Nothing
I have 1 of the following:
Workbooks.Open Filename:="C:\output.xlsm"
Windows("output.xlsm").Close SaveChanges:=False
I have loads of the following:
Set wsDest = Sheets("sheet1")
Set wsSource = Sheets("sheet2")
Do I need to set all of them to nothing???
At the very end of my code I use:
Is this where the problem is? If I use the close function it leaves excel up with no documents opened.
Bookmarks