![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
On an Excel (2003) sheet, I have a command button that executes the
following code to send an email (Outlook 2003) with the Excel workbook attached: ================================================== ========= Private Sub CommandButton1_Click() SendMail End Sub ================================================== ========= Public Sub SendMail() Dim ol As Object, myItem As Object Dim myAtts As Outlook.Attachments ActiveSheet.Shapes("CommandButton1").Delete Set ol = CreateObject("outlook.application") Set myItem = ol.CreateItem(olMailItem) myItem.To = "Lu" myItem.Subject = "Approval Request" myItem.Body = "Today's numbers are attached." Set myAtts = myItem.Attachments myAtts.Add ActiveWorkbook.FullName myItem.display Set ol = Nothing Set myItem = Nothing Application.DisplayAlerts = False ActiveWorkbook.Close End Sub ================================================== ========= The command - ActiveSheet.Shapes("CommandButton1").Delete - works. The button disappears if you set a "stop" at the next line. However, the Excel file that is actually sent has the button still displayed. How can I delete the button from the Excel attachment - it will not work for the receipient so I want it deleted. This file is used twice a week, so I don't want to delete the button and then save the file before sending. Thanks, Mike |
Ads |
#2
|
|||
|
|||
![]()
Am 27 Apr 2006 09:51:31 -0700 schrieb White Horse:
Because you attach the saved file, no not saved changes could be considered. Maybe it works if you use the Worksheet.MailEnvelope function? -- Viele Gruesse / Best regards Michael Bauer - MVP Outlook -- www.vbOffice.net -- On an Excel (2003) sheet, I have a command button that executes the following code to send an email (Outlook 2003) with the Excel workbook attached: ================================================== ========= Private Sub CommandButton1_Click() SendMail End Sub ================================================== ========= Public Sub SendMail() Dim ol As Object, myItem As Object Dim myAtts As Outlook.Attachments ActiveSheet.Shapes("CommandButton1").Delete Set ol = CreateObject("outlook.application") Set myItem = ol.CreateItem(olMailItem) myItem.To = "Lu" myItem.Subject = "Approval Request" myItem.Body = "Today's numbers are attached." Set myAtts = myItem.Attachments myAtts.Add ActiveWorkbook.FullName myItem.display Set ol = Nothing Set myItem = Nothing Application.DisplayAlerts = False ActiveWorkbook.Close End Sub ================================================== ========= The command - ActiveSheet.Shapes("CommandButton1").Delete - works. The button disappears if you set a "stop" at the next line. However, the Excel file that is actually sent has the button still displayed. How can I delete the button from the Excel attachment - it will not work for the receipient so I want it deleted. This file is used twice a week, so I don't want to delete the button and then save the file before sending. Thanks, Mike |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
How do I modify Delete button to also mark item as read? | [email protected] | Outlook and VBA | 1 | April 24th 06 07:14 AM |
O2003- how to show email account info? (esp. via email hyperlink on a button) | StargateFan | Outlook - General Queries | 2 | March 22nd 06 01:35 PM |
Email editor closes when forwarding Excel-embedded email | Outlook - General Queries | 0 | March 18th 06 03:01 PM | |
Command bar button FaceID Icon | donald | Add-ins for Outlook | 20 | February 9th 06 07:42 PM |
Command button not working on read page | jbtempe | Outlook - Using Forms | 2 | January 14th 06 12:25 AM |