Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hi, I've been using a macro to automatically send Excel worksheets to
specific email addresses on quite a few files I have set up. I just added this macro to a spreadsheet that has some merged cells that are used for notes. I realized after I began using the macro that any text typed into the merged cell beyond 250 characters is deleted when the worksheet is emailed using the macro. I don't believe this is a problem with the code, but I am including it below to make sure. Is there any work around for this? Sub Mail_ActiveSheet_PR() Dim wb As Workbook Dim strdate As String strdate = Format(Now, "yymmdd") Application.ScreenUpdating = False ActiveSheet.Copy Set wb = ActiveWorkbook With wb .SaveAs "C:\" & Sheets("Dom. Parts Order Req").Range("D11").Value & " Approved.xls" .SendMail ", Sheets("Dom. Parts Order Req").Range("D11").Value .ChangeFileAccess xlReadOnly Kill .FullName .Close False End With Application.ScreenUpdating = True End Sub Thanks, Holly |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
The only thing you can do to avoid this Excel bug (btw: fixed in excel 2007) is to
to add a new workbook with one sheet and copy all cells from your sheet in this workbook Sub Mail_ActiveSheet_PR() Dim ws As Worksheet Dim wb As Workbook Dim strdate As String strdate = Format(Now, "yymmdd") Application.ScreenUpdating = False Set ws = ActiveSheet Set wb = Workbooks.Add(1) ws.Cells.Copy wb.Sheets(1).Cells(1) ws.Name = "Dom. Parts Order Req" With wb .SaveAs "C:\" & wb.Sheets(1).Range("D11").Value & " Approved.xls" .SendMail ", wb.Sheets(1).Range("D11").Value .ChangeFileAccess xlReadOnly Kill .FullName .Close False End With Application.ScreenUpdating = True End Sub -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "hnyb1" wrote in message ... Hi, I've been using a macro to automatically send Excel worksheets to specific email addresses on quite a few files I have set up. I just added this macro to a spreadsheet that has some merged cells that are used for notes. I realized after I began using the macro that any text typed into the merged cell beyond 250 characters is deleted when the worksheet is emailed using the macro. I don't believe this is a problem with the code, but I am including it below to make sure. Is there any work around for this? Sub Mail_ActiveSheet_PR() Dim wb As Workbook Dim strdate As String strdate = Format(Now, "yymmdd") Application.ScreenUpdating = False ActiveSheet.Copy Set wb = ActiveWorkbook With wb .SaveAs "C:\" & Sheets("Dom. Parts Order Req").Range("D11").Value & " Approved.xls" .SendMail ", Sheets("Dom. Parts Order Req").Range("D11").Value .ChangeFileAccess xlReadOnly Kill .FullName .Close False End With Application.ScreenUpdating = True End Sub Thanks, Holly |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Thanks, Ron.
This worked perfectly. One more question, though. Anyway this can be made to work on emailing 2 worksheets in a workbook? Thanks again, Holly "Ron de Bruin" wrote: The only thing you can do to avoid this Excel bug (btw: fixed in excel 2007) is to to add a new workbook with one sheet and copy all cells from your sheet in this workbook Sub Mail_ActiveSheet_PR() Dim ws As Worksheet Dim wb As Workbook Dim strdate As String strdate = Format(Now, "yymmdd") Application.ScreenUpdating = False Set ws = ActiveSheet Set wb = Workbooks.Add(1) ws.Cells.Copy wb.Sheets(1).Cells(1) ws.Name = "Dom. Parts Order Req" With wb .SaveAs "C:\" & wb.Sheets(1).Range("D11").Value & " Approved.xls" .SendMail ", wb.Sheets(1).Range("D11").Value .ChangeFileAccess xlReadOnly Kill .FullName .Close False End With Application.ScreenUpdating = True End Sub -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "hnyb1" wrote in message ... Hi, I've been using a macro to automatically send Excel worksheets to specific email addresses on quite a few files I have set up. I just added this macro to a spreadsheet that has some merged cells that are used for notes. I realized after I began using the macro that any text typed into the merged cell beyond 250 characters is deleted when the worksheet is emailed using the macro. I don't believe this is a problem with the code, but I am including it below to make sure. Is there any work around for this? Sub Mail_ActiveSheet_PR() Dim wb As Workbook Dim strdate As String strdate = Format(Now, "yymmdd") Application.ScreenUpdating = False ActiveSheet.Copy Set wb = ActiveWorkbook With wb .SaveAs "C:\" & Sheets("Dom. Parts Order Req").Range("D11").Value & " Approved.xls" .SendMail ", Sheets("Dom. Parts Order Req").Range("D11").Value .ChangeFileAccess xlReadOnly Kill .FullName .Close False End With Application.ScreenUpdating = True End Sub Thanks, Holly |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Try this one for "sheet1" and "sheet3"
Sub Mail_ActiveSheet_PR() Dim i As Integer Dim sh As Worksheet Dim wb1 As Workbook Dim wb As Workbook Dim strdate As String strdate = Format(Now, "yymmdd") Application.ScreenUpdating = False Set wb1 = ThisWorkbook Set wb = Workbooks.Add(1) wb.Worksheets.Add after:=wb.Sheets(1) i = 0 For Each sh In wb1.Sheets(Array("Sheet1", "Sheet3")) i = i + 1 sh.Cells.Copy wb.Sheets(i).Cells(1) Next sh With wb .SaveAs "C:\" & wb.Sheets(1).Range("D11").Value & " Approved.xls" .SendMail ", wb.Sheets(1).Range("D11").Value .ChangeFileAccess xlReadOnly Kill .FullName .Close False End With Application.ScreenUpdating = True End Sub -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "hnyb1" wrote in message ... Thanks, Ron. This worked perfectly. One more question, though. Anyway this can be made to work on emailing 2 worksheets in a workbook? Thanks again, Holly "Ron de Bruin" wrote: The only thing you can do to avoid this Excel bug (btw: fixed in excel 2007) is to to add a new workbook with one sheet and copy all cells from your sheet in this workbook Sub Mail_ActiveSheet_PR() Dim ws As Worksheet Dim wb As Workbook Dim strdate As String strdate = Format(Now, "yymmdd") Application.ScreenUpdating = False Set ws = ActiveSheet Set wb = Workbooks.Add(1) ws.Cells.Copy wb.Sheets(1).Cells(1) ws.Name = "Dom. Parts Order Req" With wb .SaveAs "C:\" & wb.Sheets(1).Range("D11").Value & " Approved.xls" .SendMail ", wb.Sheets(1).Range("D11").Value .ChangeFileAccess xlReadOnly Kill .FullName .Close False End With Application.ScreenUpdating = True End Sub -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "hnyb1" wrote in message ... Hi, I've been using a macro to automatically send Excel worksheets to specific email addresses on quite a few files I have set up. I just added this macro to a spreadsheet that has some merged cells that are used for notes. I realized after I began using the macro that any text typed into the merged cell beyond 250 characters is deleted when the worksheet is emailed using the macro. I don't believe this is a problem with the code, but I am including it below to make sure. Is there any work around for this? Sub Mail_ActiveSheet_PR() Dim wb As Workbook Dim strdate As String strdate = Format(Now, "yymmdd") Application.ScreenUpdating = False ActiveSheet.Copy Set wb = ActiveWorkbook With wb .SaveAs "C:\" & Sheets("Dom. Parts Order Req").Range("D11").Value & " Approved.xls" .SendMail ", Sheets("Dom. Parts Order Req").Range("D11").Value .ChangeFileAccess xlReadOnly Kill .FullName .Close False End With Application.ScreenUpdating = True End Sub Thanks, Holly |
#5
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
This one is easier and also have the correct sheet names
Sub Mail_ActiveSheet_PR() Dim sh As Worksheet Dim wb1 As Workbook Dim wb2 As Workbook Dim strdate As String strdate = Format(Now, "yymmdd") Application.ScreenUpdating = False Set wb1 = ThisWorkbook wb1.Sheets(Array("Sheet1", "Sheet3")).Copy Set wb2 = ActiveWorkbook For Each sh In wb2.Worksheets wb1.Sheets(sh.Name).Cells.Copy wb2.Sheets(sh.Name).Cells(1) Next sh With wb2 .SaveAs "C:\" & wb2.Sheets(1).Range("D11").Value & " Approved.xls" .SendMail ", wb2.Sheets(1).Range("D11").Value .ChangeFileAccess xlReadOnly Kill .FullName .Close False End With Application.ScreenUpdating = True End Sub -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "Ron de Bruin" wrote in message ... Try this one for "sheet1" and "sheet3" Sub Mail_ActiveSheet_PR() Dim i As Integer Dim sh As Worksheet Dim wb1 As Workbook Dim wb As Workbook Dim strdate As String strdate = Format(Now, "yymmdd") Application.ScreenUpdating = False Set wb1 = ThisWorkbook Set wb = Workbooks.Add(1) wb.Worksheets.Add after:=wb.Sheets(1) i = 0 For Each sh In wb1.Sheets(Array("Sheet1", "Sheet3")) i = i + 1 sh.Cells.Copy wb.Sheets(i).Cells(1) Next sh With wb .SaveAs "C:\" & wb.Sheets(1).Range("D11").Value & " Approved.xls" .SendMail ", wb.Sheets(1).Range("D11").Value .ChangeFileAccess xlReadOnly Kill .FullName .Close False End With Application.ScreenUpdating = True End Sub -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "hnyb1" wrote in message ... Thanks, Ron. This worked perfectly. One more question, though. Anyway this can be made to work on emailing 2 worksheets in a workbook? Thanks again, Holly "Ron de Bruin" wrote: The only thing you can do to avoid this Excel bug (btw: fixed in excel 2007) is to to add a new workbook with one sheet and copy all cells from your sheet in this workbook Sub Mail_ActiveSheet_PR() Dim ws As Worksheet Dim wb As Workbook Dim strdate As String strdate = Format(Now, "yymmdd") Application.ScreenUpdating = False Set ws = ActiveSheet Set wb = Workbooks.Add(1) ws.Cells.Copy wb.Sheets(1).Cells(1) ws.Name = "Dom. Parts Order Req" With wb .SaveAs "C:\" & wb.Sheets(1).Range("D11").Value & " Approved.xls" .SendMail ", wb.Sheets(1).Range("D11").Value .ChangeFileAccess xlReadOnly Kill .FullName .Close False End With Application.ScreenUpdating = True End Sub -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "hnyb1" wrote in message ... Hi, I've been using a macro to automatically send Excel worksheets to specific email addresses on quite a few files I have set up. I just added this macro to a spreadsheet that has some merged cells that are used for notes. I realized after I began using the macro that any text typed into the merged cell beyond 250 characters is deleted when the worksheet is emailed using the macro. I don't believe this is a problem with the code, but I am including it below to make sure. Is there any work around for this? Sub Mail_ActiveSheet_PR() Dim wb As Workbook Dim strdate As String strdate = Format(Now, "yymmdd") Application.ScreenUpdating = False ActiveSheet.Copy Set wb = ActiveWorkbook With wb .SaveAs "C:\" & Sheets("Dom. Parts Order Req").Range("D11").Value & " Approved.xls" .SendMail ", Sheets("Dom. Parts Order Req").Range("D11").Value .ChangeFileAccess xlReadOnly Kill .FullName .Close False End With Application.ScreenUpdating = True End Sub Thanks, Holly |
#6
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Thank you so much! This is excellent.
"Ron de Bruin" wrote: This one is easier and also have the correct sheet names Sub Mail_ActiveSheet_PR() Dim sh As Worksheet Dim wb1 As Workbook Dim wb2 As Workbook Dim strdate As String strdate = Format(Now, "yymmdd") Application.ScreenUpdating = False Set wb1 = ThisWorkbook wb1.Sheets(Array("Sheet1", "Sheet3")).Copy Set wb2 = ActiveWorkbook For Each sh In wb2.Worksheets wb1.Sheets(sh.Name).Cells.Copy wb2.Sheets(sh.Name).Cells(1) Next sh With wb2 .SaveAs "C:\" & wb2.Sheets(1).Range("D11").Value & " Approved.xls" .SendMail ", wb2.Sheets(1).Range("D11").Value .ChangeFileAccess xlReadOnly Kill .FullName .Close False End With Application.ScreenUpdating = True End Sub -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "Ron de Bruin" wrote in message ... Try this one for "sheet1" and "sheet3" Sub Mail_ActiveSheet_PR() Dim i As Integer Dim sh As Worksheet Dim wb1 As Workbook Dim wb As Workbook Dim strdate As String strdate = Format(Now, "yymmdd") Application.ScreenUpdating = False Set wb1 = ThisWorkbook Set wb = Workbooks.Add(1) wb.Worksheets.Add after:=wb.Sheets(1) i = 0 For Each sh In wb1.Sheets(Array("Sheet1", "Sheet3")) i = i + 1 sh.Cells.Copy wb.Sheets(i).Cells(1) Next sh With wb .SaveAs "C:\" & wb.Sheets(1).Range("D11").Value & " Approved.xls" .SendMail ", wb.Sheets(1).Range("D11").Value .ChangeFileAccess xlReadOnly Kill .FullName .Close False End With Application.ScreenUpdating = True End Sub -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "hnyb1" wrote in message ... Thanks, Ron. This worked perfectly. One more question, though. Anyway this can be made to work on emailing 2 worksheets in a workbook? Thanks again, Holly "Ron de Bruin" wrote: The only thing you can do to avoid this Excel bug (btw: fixed in excel 2007) is to to add a new workbook with one sheet and copy all cells from your sheet in this workbook Sub Mail_ActiveSheet_PR() Dim ws As Worksheet Dim wb As Workbook Dim strdate As String strdate = Format(Now, "yymmdd") Application.ScreenUpdating = False Set ws = ActiveSheet Set wb = Workbooks.Add(1) ws.Cells.Copy wb.Sheets(1).Cells(1) ws.Name = "Dom. Parts Order Req" With wb .SaveAs "C:\" & wb.Sheets(1).Range("D11").Value & " Approved.xls" .SendMail ", wb.Sheets(1).Range("D11").Value .ChangeFileAccess xlReadOnly Kill .FullName .Close False End With Application.ScreenUpdating = True End Sub -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "hnyb1" wrote in message ... Hi, I've been using a macro to automatically send Excel worksheets to specific email addresses on quite a few files I have set up. I just added this macro to a spreadsheet that has some merged cells that are used for notes. I realized after I began using the macro that any text typed into the merged cell beyond 250 characters is deleted when the worksheet is emailed using the macro. I don't believe this is a problem with the code, but I am including it below to make sure. Is there any work around for this? Sub Mail_ActiveSheet_PR() Dim wb As Workbook Dim strdate As String strdate = Format(Now, "yymmdd") Application.ScreenUpdating = False ActiveSheet.Copy Set wb = ActiveWorkbook With wb .SaveAs "C:\" & Sheets("Dom. Parts Order Req").Range("D11").Value & " Approved.xls" .SendMail ", Sheets("Dom. Parts Order Req").Range("D11").Value .ChangeFileAccess xlReadOnly Kill .FullName .Close False End With Application.ScreenUpdating = True End Sub Thanks, Holly |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
macro to email | Excel Discussion (Misc queries) | |||
Email and Excel Problem | Excel Worksheet Functions | |||
How do I email an excel macro? | Excel Discussion (Misc queries) | |||
Problem opening excel files from email | Excel Discussion (Misc queries) | |||
Macro To Email XLS | Excel Discussion (Misc queries) |