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: 9,101
Default Copy Multiple Sheets, Except Q

I ran you code and didn't get any problems on the line

sht.Copy

This line has a period between sht and copy which you didn't have in the
previous posting where you said you had a problem. I tried repeating the
problem by using different number of sheets in my workbook but still didn't
repeat your problem.

When you use COPY on a sheet without the parameter AFTER or BEFORE excel
creates a new workbook. The new workbook only has one sheet (the one you
copied) and doesn't have any macros. I like this procedure better than using
Workbooks.Add because the Add method will create a new workbook with 3 blank
worksheets (or whatever you have the defualt number of sheets set to in Tools
- Option).

I would also rewrite this section of code

With Destwb
If First = False then
.SaveAs TempFilePath & TempFileName &FileExtStr, _
FileFormat:=FileFormatNum
End if
With OutMail
.To = "
.CC = ""
.BCC = ""
.Subject = "Database of Orders"
If First = true then
.Body = "There are no Historic Orders to E-Mail"
Else
.Body = ""
.Attachments.Add Destwb.FullName
End if
.ReadReceiptRequested = True
.SendUsingAccount = OutApp.Session.Accounts.Item(1)
.Send
End With
.Close savechanges:=False
End With

If First = False then
Kill TempFilePath & TempFileName & FileExtStr
End If

"Joel" wrote:

Your description of the failure doesn't make sense. If you have only A,B,C,D
then you will never do a copy so your won't get to the failure you are
descriping. Post all your code so I can see the changes you made.

"Seanie" wrote:

Thanks, It debugs with message "Copy Method of Worksheet class failed"
on text

sht Copy

This is when there are no sheets apart from A,B,C,D. If I have a sheet
other than those, code works fine




 
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 rows to multiple sheets pvkutty Excel Discussion (Misc queries) 1 February 24th 10 07:25 AM
Copy multiple sheets using a list box kev_06[_3_] Excel Programming 1 June 2nd 06 11:10 PM
Copy & Past from multiple sheets to one Prometheus[_12_] Excel Programming 18 December 5th 05 12:36 AM
Multiple sheets selection and copy syaronc[_6_] Excel Programming 1 October 25th 04 12:40 PM
Copy from Multiple Sheets Eric[_23_] Excel Programming 3 August 5th 04 07:00 PM


All times are GMT +1. The time now is 01:46 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"