Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Copy sheet--Some cells more than 255 characters

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Copy sheet--Some cells more than 255 characters

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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Copy sheet--Some cells more than 255 characters

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" wrote in message
...
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
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 select characters from specified cells. Ron Excel Worksheet Functions 3 October 9th 06 08:40 PM
How to copy the cell contains above 255 characters from one sheet. Senthil Excel Discussion (Misc queries) 1 August 8th 06 04:48 AM
Move Copy sheet with cell having more than 255 characters Ajit Excel Programming 0 November 5th 04 07:56 PM
Copy Cells with More than 255 Characters Tim Childs Excel Programming 3 May 13th 04 01:51 PM
Copy data where some cells exceed 256 characters Stuart[_5_] Excel Programming 2 November 19th 03 05:49 PM


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