#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 63
Default Macro Error

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.
  #2   Report Post  
Posted to microsoft.public.excel.misc
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
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,942
Default Macro Error

hi
your last line of code doesn't make sense. Before is a keyword used when
adding a sheet. is that what your are trying to do? add a sheet to book 1.
you need to activate book 1 or add book 1 first.

post back with more info on what your are doing.
regards
FSt1

"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.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
I tried to get around the problem of the pivot table field settingdefaulting to Count instead of Sum by running a macro of change the settingfrom Count to Sum. However, when I tried to run the Macro, I got error messageof run time error 1004, unable Enda80 Excel Worksheet Functions 1 May 3rd 08 02:35 PM
I tried to get around the problem of the pivot table field settingdefaulting to Count instead of Sum by running a macro of change the settingfrom Count to Sum. However, when I tried to run the Macro, I got error messageof run time error 1004, unable Enda80 Excel Discussion (Misc queries) 1 May 3rd 08 10:52 AM
Macro error : Application-defined or object-defined error Joe Excel Discussion (Misc queries) 3 January 27th 06 02:32 PM
Excel 2003 Macro Error - Runtime error 1004 Cow Excel Discussion (Misc queries) 2 June 7th 05 01:40 PM
run macro error, please help [email protected] Excel Discussion (Misc queries) 0 February 8th 05 03:52 AM


All times are GMT +1. The time now is 04:25 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"