Alright so imagining it last night while driving to eat I wondered if Workbook.Add()
setting the new workbook as active might be part of the problem by changing the ActiveWorkbook before the implicit Range("Table1[#All]")
is evaluated.
So
Workbooks("*Initial*").ActiveSheet.Range("Table1[#All]").Copy Destination:=Workbooks.Add().ActiveSheet.Range("A1")
does work.
I learned or reinforced 3 main things:
- Parentheses are needed for
.Add
even without using arguments to return a Workbook from the Workbooks collection just like would be required using an implicit call to the default member of Workbooks, Workbooks.Item()
with an argument.
- Order of how operations are executed within a single instruction
- Watch out for Implicit references and secondary operations
Thanks to everyone that responded. Before I posted this question I expected the 1st response to be "Why?", and was not disappointed. I almost didn't even post.
Yes before I posted I knew I could just do Workbooks.Add
1st but then I would have just used the clipboard to copy the table 1st which would have been maybe slightly less desirable I almost did just that and would have kept trucking. More importantly I would not have learned what I have.
I'm always open to any advice. Many here are tried and true on the topic of Excel VBA whereas I maybe write a little macro once or twice a year. I didn't persist for stubbornness of doing something my way but to understand from my point of view.