#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 355
Default 2007 Help

Hi
The following bit of code has been working previously excel2003

Dim wks as worksheet
Dim actWkbk As Workbook
Set actWkbk = ActiveWorkbook
With act wkbk
..Worksheets("Sheet1").copy
End with

now in 2007 I am getting Method 'Copy' of object '_Worksheet failed'

What has changed?
Thanks!

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,651
Default 2007 Help

On Mon, 19 Nov 2007 12:40:02 -0800, Sandy
wrote:

Hi
The following bit of code has been working previously excel2003

Dim wks as worksheet
Dim actWkbk As Workbook
Set actWkbk = ActiveWorkbook
With act wkbk
.Worksheets("Sheet1").copy
End with

now in 2007 I am getting Method 'Copy' of object '_Worksheet failed'

What has changed?
Thanks!


Could it be the <space between 'act' and 'wkbk' ?

Probably combined with no Option Explicit statement.
--ron
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default 2007 Help

Hi Sandy,

I am using xl2007 with Windows Vista Home and your code works perfectly for
me. (I had to remove the space in 'With act wkbk'; but I assume that is only
a typo when you posted.)

It creates a new workbook with only one worksheet.

--
Regards,

OssieMac


"Sandy" wrote:

Hi
The following bit of code has been working previously excel2003

Dim wks as worksheet
Dim actWkbk As Workbook
Set actWkbk = ActiveWorkbook
With act wkbk
.Worksheets("Sheet1").copy
End with

now in 2007 I am getting Method 'Copy' of object '_Worksheet failed'

What has changed?
Thanks!

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 355
Default 2007 Help

Thanks!
The space was a typo. It appears the problem is the macro is running from
an xls (65000lines X 256 Colimns) and it is copying this sheet into an .xlsm
with a Gazillion columns x 256 katrillion lines.
Thanks again!

"Sandy" wrote:

Hi
The following bit of code has been working previously excel2003

Dim wks as worksheet
Dim actWkbk As Workbook
Set actWkbk = ActiveWorkbook
With act wkbk
.Worksheets("Sheet1").copy
End with

now in 2007 I am getting Method 'Copy' of object '_Worksheet failed'

What has changed?
Thanks!

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
Copying Excel 2007 chart to Word 2007 - only half of it shows NonTechie Excel Discussion (Misc queries) 2 November 3rd 09 09:26 PM
Analysis Toolpack Issues in Excel 2007 (Office 2007 Enterprise) Ben Shields Excel Discussion (Misc queries) 2 February 24th 09 05:04 PM
Excel 2007 Query Wizard problem with Access 2007 extensions Showdad Excel Discussion (Misc queries) 0 December 4th 08 05:57 PM
Labels: Unable to import all records Excel 2007 to Word 2007 Mailm skelly Excel Discussion (Misc queries) 1 October 29th 08 11:22 PM
Paste EXCEL 2007 sheet into WORD 2007 - objects move around Martin L Excel Discussion (Misc queries) 5 February 29th 08 01:45 PM


All times are GMT +1. The time now is 07:35 AM.

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

About Us

"It's about Microsoft Excel"