LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Copy Method of WorkSheet Class Failed!

Sub Copy Sheets
Dim sName as String, Icounter as Long
Dim oBook as Workbook
sName = Activeworkbook.FullName
set oBook = ActiveWorkbook
For iCounter = 1 To 275
oBook.Worksheets(1).Copy After:= _
oBook.Worksheets(oBook.Worksheets.count)
'Save, close, and reopen after every 2 iterations:
If iCounter Mod 100 = 2 Then
oBook.Close SaveChanges:=True
Set oBook = Nothing
Set oBook = Application.Workbooks.Open(sName)
End If
Next
End Sub

or to do it every time

Sub Copy Sheets
Dim sName as String, Icounter as Long
Dim oBook as Workbook
sName = Activeworkbook.FullName
set oBook = ActiveWorkbook
For iCounter = 1 To 275
oBook.Worksheets(1).Copy After:= _
oBook.Worksheets(oBook.Worksheets.count)
'Save, close, and reopen after every 1 iterations:
' If iCounter Mod 100 = 2 Then
oBook.Close SaveChanges:=True
Set oBook = Nothing
Set oBook = Application.Workbooks.Open(sName)
' End If
Next
End Sub

--
Regards,
Tom Ogilvy

wrote in message
ups.com...
Totally Baffled!..It comes up the copy error every 15th copy.
I've done this 3 times now (it copies 6, saves, closes then opens) and
even during third time I even copied the file from the network to the
local hard disk and continued the run from there and it still failed on
the 15th attempt....It's looking more like I'm going to have to log out
of windows every time!?!....help ..I've got alot of these to
do..........





 
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
Copy Method of Worksheet Class Failed Steph[_3_] Excel Programming 2 April 7th 04 01:43 PM
Copy Method of Worksheet Class Failed Steph[_3_] Excel Programming 0 April 5th 04 11:12 PM
Copy Method of Worksheet Class Failed Steph[_3_] Excel Programming 1 April 5th 04 10:15 PM
Copy Method of Worksheet Class Failed Steph[_3_] Excel Programming 1 April 5th 04 09:38 PM
Copy Method of Worksheet Class Failed Steph[_3_] Excel Programming 1 April 5th 04 07:56 PM


All times are GMT +1. The time now is 05:36 PM.

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"