View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.excel.crashesgpfs
Richard[_24_] Richard[_24_] is offline
external usenet poster
 
Posts: 1
Default Copy generates an automation error.

Hi, everybody

The following code works just one time. If It runs again without
exiting Excel it generates an automation error. Why ? Any workaround ?
Is there a problem with tyhe Copy method ?

Public Sub Atry()
'***
Dim aw As Workbook
Set aw = ActiveWorkbook
Workbooks.Open "c:\temp.xls"
ActiveSheet.Copy After:=aw.Sheets(aw.Sheets.Count) '<-- This were the
problem is
Windows("temp.xls").Close
Set aw = Nothing
End Sub