Closing a workbook
I have the following code.
Workbooks.Open Filename:="C:\Documents and Settings\earpn\Desktop\A"
Sheets("EmailList").Select
Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Sheets("Report").Select
Range("A2").Select
I need to put this into the open procedure of the workbook thats being
opened in the first line of the code. So in the code i need to simply select
the workbook (A) and paste the code rather than open the workbook (A) and
paste the code.
I then need to close the workbook that i got the copied cells from. so i
need to select that workbook and close it and then select the workbook (A)
again.
The code above does work when i use it in a new excel workbook and copies
and pastes fine (but can't close the other book as i can't seem to select it).
Any help on selecting a workbook would be appreciated.
Thanks
|