Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I was looking for some code that would allow users to click on a button that
would email a spreadsheet after they inputted their information. What I was hoping for would be the user would have a particular cell where they would enter an email address or perhaps select an email address from a drop down box, then they would hit Submit and the file would attach and the name they entered would already be populated in the TO box. Also, would it be possible to do a CC or have the subject of the email already entered. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Kris
Look for the Outlook object mode examples on this page http://www.rondebruin.nl/sendmail.htm Click on the Tip link that you find on each example page -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "Kris" wrote in message ... I was looking for some code that would allow users to click on a button that would email a spreadsheet after they inputted their information. What I was hoping for would be the user would have a particular cell where they would enter an email address or perhaps select an email address from a drop down box, then they would hit Submit and the file would attach and the name they entered would already be populated in the TO box. Also, would it be possible to do a CC or have the subject of the email already entered. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am trying to use this part of your site.....
Or you can use a mail address in a cell like this .To = ThisWorkbook.Sheets("Sheet1").Range("C1").Value However, the email address in c1 is not emailed. Here is what I have behind the command button. The cc address does receive the email. 'Working in 2000-2007 'This example send the last saved version of the Activeworkbook Dim OutApp As Object Dim OutMail As Object Set OutApp = CreateObject("Outlook.Application") OutApp.Session.Logon Set OutMail = OutApp.CreateItem(0) On Error Resume Next With OutMail .To = ThisWorkbook.Sheets("Sheet1").Range("c1").Value .CC = " .BCC = "" .Subject = "Timesheet Submission" .Body = "I certify this timesheet is correct. I am forwarding this to you for management approval." .Attachments.Add ActiveWorkbook.FullName 'You can add other files also like this '.Attachments.Add ("C:\test.txt") .Send 'or use .Display End With On Error GoTo 0 Set OutMail = Nothing Set OutApp = Nothing End Sub "Ron de Bruin" wrote: Hi Kris Look for the Outlook object mode examples on this page http://www.rondebruin.nl/sendmail.htm Click on the Tip link that you find on each example page -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "Kris" wrote in message ... I was looking for some code that would allow users to click on a button that would email a spreadsheet after they inputted their information. What I was hoping for would be the user would have a particular cell where they would enter an email address or perhaps select an email address from a drop down box, then they would hit Submit and the file would attach and the name they entered would already be populated in the TO box. Also, would it be possible to do a CC or have the subject of the email already entered. |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Kris
Is your sheet names "Sheet1" Do you want to send the workbook where the code is -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "Kris" wrote in message ... I am trying to use this part of your site..... Or you can use a mail address in a cell like this .To = ThisWorkbook.Sheets("Sheet1").Range("C1").Value However, the email address in c1 is not emailed. Here is what I have behind the command button. The cc address does receive the email. 'Working in 2000-2007 'This example send the last saved version of the Activeworkbook Dim OutApp As Object Dim OutMail As Object Set OutApp = CreateObject("Outlook.Application") OutApp.Session.Logon Set OutMail = OutApp.CreateItem(0) On Error Resume Next With OutMail .To = ThisWorkbook.Sheets("Sheet1").Range("c1").Value .CC = " .BCC = "" .Subject = "Timesheet Submission" .Body = "I certify this timesheet is correct. I am forwarding this to you for management approval." .Attachments.Add ActiveWorkbook.FullName 'You can add other files also like this '.Attachments.Add ("C:\test.txt") .Send 'or use .Display End With On Error GoTo 0 Set OutMail = Nothing Set OutApp = Nothing End Sub "Ron de Bruin" wrote: Hi Kris Look for the Outlook object mode examples on this page http://www.rondebruin.nl/sendmail.htm Click on the Tip link that you find on each example page -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "Kris" wrote in message ... I was looking for some code that would allow users to click on a button that would email a spreadsheet after they inputted their information. What I was hoping for would be the user would have a particular cell where they would enter an email address or perhaps select an email address from a drop down box, then they would hit Submit and the file would attach and the name they entered would already be populated in the TO box. Also, would it be possible to do a CC or have the subject of the email already entered. |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
yes, I would like to send the entire workbook and not just a particular sheet.
"Ron de Bruin" wrote: Hi Kris Is your sheet names "Sheet1" Do you want to send the workbook where the code is -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "Kris" wrote in message ... I am trying to use this part of your site..... Or you can use a mail address in a cell like this .To = ThisWorkbook.Sheets("Sheet1").Range("C1").Value However, the email address in c1 is not emailed. Here is what I have behind the command button. The cc address does receive the email. 'Working in 2000-2007 'This example send the last saved version of the Activeworkbook Dim OutApp As Object Dim OutMail As Object Set OutApp = CreateObject("Outlook.Application") OutApp.Session.Logon Set OutMail = OutApp.CreateItem(0) On Error Resume Next With OutMail .To = ThisWorkbook.Sheets("Sheet1").Range("c1").Value .CC = " .BCC = "" .Subject = "Timesheet Submission" .Body = "I certify this timesheet is correct. I am forwarding this to you for management approval." .Attachments.Add ActiveWorkbook.FullName 'You can add other files also like this '.Attachments.Add ("C:\test.txt") .Send 'or use .Display End With On Error GoTo 0 Set OutMail = Nothing Set OutApp = Nothing End Sub "Ron de Bruin" wrote: Hi Kris Look for the Outlook object mode examples on this page http://www.rondebruin.nl/sendmail.htm Click on the Tip link that you find on each example page -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "Kris" wrote in message ... I was looking for some code that would allow users to click on a button that would email a spreadsheet after they inputted their information. What I was hoping for would be the user would have a particular cell where they would enter an email address or perhaps select an email address from a drop down box, then they would hit Submit and the file would attach and the name they entered would already be populated in the TO box. Also, would it be possible to do a CC or have the subject of the email already entered. |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
.To = ThisWorkbook.Sheets("Sheet1").Range("C1").Value
Is the workbook with the macro also the workbook that you want to send ? Is the mail address in a sheet named "Sheet1" of that workbook ? -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "Kris" wrote in message ... yes, I would like to send the entire workbook and not just a particular sheet. "Ron de Bruin" wrote: Hi Kris Is your sheet names "Sheet1" Do you want to send the workbook where the code is -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "Kris" wrote in message ... I am trying to use this part of your site..... Or you can use a mail address in a cell like this .To = ThisWorkbook.Sheets("Sheet1").Range("C1").Value However, the email address in c1 is not emailed. Here is what I have behind the command button. The cc address does receive the email. 'Working in 2000-2007 'This example send the last saved version of the Activeworkbook Dim OutApp As Object Dim OutMail As Object Set OutApp = CreateObject("Outlook.Application") OutApp.Session.Logon Set OutMail = OutApp.CreateItem(0) On Error Resume Next With OutMail .To = ThisWorkbook.Sheets("Sheet1").Range("c1").Value .CC = " .BCC = "" .Subject = "Timesheet Submission" .Body = "I certify this timesheet is correct. I am forwarding this to you for management approval." .Attachments.Add ActiveWorkbook.FullName 'You can add other files also like this '.Attachments.Add ("C:\test.txt") .Send 'or use .Display End With On Error GoTo 0 Set OutMail = Nothing Set OutApp = Nothing End Sub "Ron de Bruin" wrote: Hi Kris Look for the Outlook object mode examples on this page http://www.rondebruin.nl/sendmail.htm Click on the Tip link that you find on each example page -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "Kris" wrote in message ... I was looking for some code that would allow users to click on a button that would email a spreadsheet after they inputted their information. What I was hoping for would be the user would have a particular cell where they would enter an email address or perhaps select an email address from a drop down box, then they would hit Submit and the file would attach and the name they entered would already be populated in the TO box. Also, would it be possible to do a CC or have the subject of the email already entered. |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
okay, you were correct. I had to change the Sheet 1 address. Would it be
possible to have the user hit a drop down box and pick a particular email address. The submit button would then read what is in the drop down box and email that person? "Kris" wrote: yes, I would like to send the entire workbook and not just a particular sheet. "Ron de Bruin" wrote: Hi Kris Is your sheet names "Sheet1" Do you want to send the workbook where the code is -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "Kris" wrote in message ... I am trying to use this part of your site..... Or you can use a mail address in a cell like this .To = ThisWorkbook.Sheets("Sheet1").Range("C1").Value However, the email address in c1 is not emailed. Here is what I have behind the command button. The cc address does receive the email. 'Working in 2000-2007 'This example send the last saved version of the Activeworkbook Dim OutApp As Object Dim OutMail As Object Set OutApp = CreateObject("Outlook.Application") OutApp.Session.Logon Set OutMail = OutApp.CreateItem(0) On Error Resume Next With OutMail .To = ThisWorkbook.Sheets("Sheet1").Range("c1").Value .CC = " .BCC = "" .Subject = "Timesheet Submission" .Body = "I certify this timesheet is correct. I am forwarding this to you for management approval." .Attachments.Add ActiveWorkbook.FullName 'You can add other files also like this '.Attachments.Add ("C:\test.txt") .Send 'or use .Display End With On Error GoTo 0 Set OutMail = Nothing Set OutApp = Nothing End Sub "Ron de Bruin" wrote: Hi Kris Look for the Outlook object mode examples on this page http://www.rondebruin.nl/sendmail.htm Click on the Tip link that you find on each example page -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "Kris" wrote in message ... I was looking for some code that would allow users to click on a button that would email a spreadsheet after they inputted their information. What I was hoping for would be the user would have a particular cell where they would enter an email address or perhaps select an email address from a drop down box, then they would hit Submit and the file would attach and the name they entered would already be populated in the TO box. Also, would it be possible to do a CC or have the subject of the email already entered. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Command Button - Macro to print to pdf, then send pdf to email. | Excel Discussion (Misc queries) | |||
BCC Email using a Command Button | Excel Discussion (Misc queries) | |||
Command Button to email worksheets | Excel Programming | |||
Add email attachment to command button | Excel Discussion (Misc queries) | |||
Use command button to send email | Excel Programming |