Hi All;
I was having problems with linking Pivot Data through VBA because sometimes it would not be able to open the file correctly to get the data.
To fix this, I just had the Macro open the Workbooks first, and then link to them, which has solved that problem.
However, having opened these specific workbooks, I can't find a way to close them! Now, as problems go, this is not USA vs Russia Cold War problems, but it offends my sense of neatness!
So, this is the start of the Macro (where I open the Workbooks)
And this is the end of the Macro, where I am attempting to close those very same Workbooks
So, what am I doing wrong?
I was having problems with linking Pivot Data through VBA because sometimes it would not be able to open the file correctly to get the data.
To fix this, I just had the Macro open the Workbooks first, and then link to them, which has solved that problem.
However, having opened these specific workbooks, I can't find a way to close them! Now, as problems go, this is not USA vs Russia Cold War problems, but it offends my sense of neatness!
So, this is the start of the Macro (where I open the Workbooks)
MONTHP = Sheets("Front Sheet").Range("B12").Value
CQUARTER = Sheets("Front Sheet").Range("B12").Value
NQUARTER = Sheets("Front Sheet").Range("B12").Value
FULLYEAR = Sheets("Front Sheet").Range("B12").Value
MONTHP2 = Sheets("Front Sheet").Range("B15").Value
CQUARTER2 = Sheets("Front Sheet").Range("B16").Value
NQUARTER2 = Sheets("Front Sheet").Range("B17").Value
FULLYEAR2 = Sheets("Front Sheet").Range("B18").Value
'
Application.ScreenUpdating = False
Workbooks.Open (MONTHP & MONTHP2)
Workbooks.Open (CQUARTER & CQUARTER2)
Workbooks.Open (NQUARTER & NQUARTER2)
Workbooks.Open (FULLYEAR & FULLYEAR2)
ThisWorkbook.Activate
And this is the end of the Macro, where I am attempting to close those very same Workbooks
Workbooks(MONTHP & MONTHP2).Select
Workbooks(MONTHP & MONTHP2).Close False
Workbooks(CQUARTER & CQUARTER2).Select
Workbooks(CQUARTER & CQUARTER2).Close False
Workbooks(NQUARTER & NQUARTER2).Select
Workbooks(NQUARTER & NQUARTER2).Close False
Workbooks(FULLYEAR & FULLYEAR2).Select
Workbooks(FULLYEAR & FULLYEAR2).Close False
So, what am I doing wrong?