Thread: Macro Error
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Macro Error

I'd try including the .xls extension:
Sheets("Cover Sht").Copy Befo=Workbooks("Book1.xls").Sheets(1)

Or maybe...

dim wks as worksheet
set wks = Workbooks.Open(Filename:="C:\Temp\Mgmt Team Stmt legacy.xls") _
.worksheets("cover sht")
wks.copy _
Befo=Workbooks("Book1.xls").Sheets(1)

'maybe???
wks.parent.close savechanges:=false

Vick wrote:

I keep receiving this error and I can't figure out what i've done wrong, any
help would be appreciated. Thanks

Workbooks.Open Filename:="C:\Temp\Mgmt Team Stmt legacy.xls"
Windows("Mgmt Team Stmt legacy.xls").Activate
Sheets("Cover Sht").Select
Sheets("Cover Sht").Copy Befo=Workbooks("Book1").Sheets(1)

All I'm trying to do is copy a worksheet from a workbook, to another workbook.

The last line is the line that continues to error out.


--

Dave Peterson