help with macro to open and close workbooks

  • Thread starter Thread starter aneurin
  • Start date Start date
A

aneurin

all this macro does is save the Summary Report Master worbook and
create a copy of it in another folder
everything works fine up untill this point
as you can see i then select the workbook Data Summary Report Query
and try to close it
but it will not close
can anyone point me in the right direction
cheers
aneurin

Sub Main()
Sheets("Data Summary").Select
Range("A6").Select
ChDir "c:\Documents and Settings\Desktop"
Workbooks.Open Filename:= _
"c:\Documents and Settings\Desktop\Summary Report Master.xls"
Sheets("Data Summary").Select
Windows("Data Summary Report Query.xls").Activate
Range("a1:h20").Select
Selection.Copy
Windows("Data Summary Report Master.xls").Activate
Sheets("Data Summary").Select
Range("A6").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=False
Range("A6").Select
Windows("Data Summary Report master.xls").Activate
Application.Run "'Data Summary Report master.xls'!saveit"
Windows("Data Summary Report Query.xls").Activate
Sheets("data summary").Select
Range("a1").Select
'saveitn
Application.DisplayAlerts = False
ActiveWorkbook.Close
End Sub
 
hi

correct me if i'm wrong... but i think perhaps u need to close the
active window, * ActiveWindow.Close * instead of * ActiveWorkbook.Close
* (2nd last line)

cheers
 
Back
Top