PC Review


Reply
Thread Tools Rate Thread

Copy sheet--Some cells more than 255 characters

 
 
=?Utf-8?B?SnVkc2VuIEpvbmVz?=
Guest
Posts: n/a
 
      9th Aug 2007
I am using the following code to copy and email the entire sheet.

I am trying to figure out a work around the 255 character limit. This macro
creates the sheet/email in the background. I am having trouble with how to
work in the copy of cells more than 255 characters, as I have read the only
fix is to copy the original cell/cells into the new sheet.

Thanks in advance.

----------------Code----------------
Sub Mail_ActiveSheet()
Dim wb As Workbook
On Error GoTo ErrorHandler
Application.EnableEvents = False
Application.ScreenUpdating = False
ActiveSheet.Copy
Set wb = ActiveWorkbook
With wb
' Names the worksheet the same as activesheet
.SaveAs ActiveSheet.Name & ".xls"
' Next line has "" which is a blank email. Allows you to send to whom you
want.
.SendMail "", _
ActiveSheet.Name
' Above line is the subject line "This is the Subject line" 'Type the
subject in the previous quotes
.ChangeFileAccess xlReadOnly
Kill .FullName
.Close False
End With
ErrorHandler:
Application.ScreenUpdating = True
Application.EnableEvents = True
End Sub
 
Reply With Quote
 
 
 
 
=?Utf-8?B?SmltIFRob21saW5zb24=?=
Guest
Posts: n/a
 
      9th Aug 2007
Perhaps something like this...

Sub Mail_ActiveSheet()
Dim wb As Workbook
dim wks as worksheet
On Error GoTo ErrorHandler
Application.EnableEvents = False
Application.ScreenUpdating = False
set wks = activesheet
wks.Copy
Set wb = ActiveWorkbook
With wb
wks.cells.copy Destination:= .activesheet.cells

' Names the worksheet the same as activesheet
.SaveAs ActiveSheet.Name & ".xls"
' Next line has "" which is a blank email. Allows you to send to whom you
want.
.SendMail "", _
ActiveSheet.Name
' Above line is the subject line "This is the Subject line" 'Type the
subject in the previous quotes
.ChangeFileAccess xlReadOnly
Kill .FullName
.Close False
End With
ErrorHandler:
Application.ScreenUpdating = True
Application.EnableEvents = True
End Sub
--
HTH...

Jim Thomlinson


"Judsen Jones" wrote:

> I am using the following code to copy and email the entire sheet.
>
> I am trying to figure out a work around the 255 character limit. This macro
> creates the sheet/email in the background. I am having trouble with how to
> work in the copy of cells more than 255 characters, as I have read the only
> fix is to copy the original cell/cells into the new sheet.
>
> Thanks in advance.
>
> ----------------Code----------------
> Sub Mail_ActiveSheet()
> Dim wb As Workbook
> On Error GoTo ErrorHandler
> Application.EnableEvents = False
> Application.ScreenUpdating = False
> ActiveSheet.Copy
> Set wb = ActiveWorkbook
> With wb
> ' Names the worksheet the same as activesheet
> .SaveAs ActiveSheet.Name & ".xls"
> ' Next line has "" which is a blank email. Allows you to send to whom you
> want.
> .SendMail "", _
> ActiveSheet.Name
> ' Above line is the subject line "This is the Subject line" 'Type the
> subject in the previous quotes
> .ChangeFileAccess xlReadOnly
> Kill .FullName
> .Close False
> End With
> ErrorHandler:
> Application.ScreenUpdating = True
> Application.EnableEvents = True
> End Sub

 
Reply With Quote
 
Peter T
Guest
Posts: n/a
 
      9th Aug 2007
Sub test()
Dim wsSource As Worksheet
Dim wb As Workbook
Dim wsDest As Worksheet
Dim nSiNW As Long

Set wsSource = ActiveWorkbook.ActiveSheet
nSiNW = Application.SheetsInNewWorkbook
Application.SheetsInNewWorkbook = 1
Set wb = Workbooks.Add
Application.SheetsInNewWorkbook = nSiNW
Set wsDest = wb.Worksheets(1)

wsSource.Cells.Copy wsDest.Cells

' wb.SaveAs etc....

End Sub

Regards,
Peter T

"Judsen Jones" <(E-Mail Removed)> wrote in message
news9D09B27-D0FC-4692-B233-(E-Mail Removed)...
> I am using the following code to copy and email the entire sheet.
>
> I am trying to figure out a work around the 255 character limit. This

macro
> creates the sheet/email in the background. I am having trouble with how to
> work in the copy of cells more than 255 characters, as I have read the

only
> fix is to copy the original cell/cells into the new sheet.
>
> Thanks in advance.
>
> ----------------Code----------------
> Sub Mail_ActiveSheet()
> Dim wb As Workbook
> On Error GoTo ErrorHandler
> Application.EnableEvents = False
> Application.ScreenUpdating = False
> ActiveSheet.Copy
> Set wb = ActiveWorkbook
> With wb
> ' Names the worksheet the same as activesheet
> .SaveAs ActiveSheet.Name & ".xls"
> ' Next line has "" which is a blank email. Allows you to send to whom you
> want.
> .SendMail "", _
> ActiveSheet.Name
> ' Above line is the subject line "This is the Subject line" 'Type the
> subject in the previous quotes
> .ChangeFileAccess xlReadOnly
> Kill .FullName
> .Close False
> End With
> ErrorHandler:
> Application.ScreenUpdating = True
> Application.EnableEvents = True
> End Sub



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy Sheet to new Sheet and clear cells on original sheets Boiler-Todd Microsoft Excel Misc 7 23rd Sep 2009 10:02 PM
RE: Copy sheet cells into differnt workbook/sheet, How? Shane Devenshire Microsoft Excel Misc 1 2nd Jun 2009 11:16 PM
copy data of two cells from Sheet 2 into one cell in Sheet 1 cahabbinga Microsoft Excel Worksheet Functions 6 30th Jan 2008 01:00 PM
How to copy the cell contains above 255 characters from one sheet. =?Utf-8?B?U2VudGhpbA==?= Microsoft Excel Misc 1 8th Aug 2006 04:48 AM
Copy sheet and clear cells on new sheet at sametime. Brad Withrow Microsoft Excel Programming 2 10th Apr 2006 12:49 AM


Features
 

Advertising
 

Newsgroups
 


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