![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Feb 2002
Location: Jefferson City, Missouri
Posts: 383
|
Right now I am using this code to copy a page, e-mail it, then delete the copy.
What I've run into is that the receiver of the e-mail will not be the same. So, what I'm wanting to do is have a cell contain the name of person that will receive the e-mail and then when the command button is clicked it will send it to that name. Here's the code: Sub SendIt() Application.ScreenUpdating = False Application.DisplayAlerts = False Sheet1.Copy ActiveWorkbook.SaveAs Filename:="Purchase Journal.xls", _ FileFormat:=xlNormal, Password:="", WriteResPassword:="", _ ReadOnlyRecommended:=True, CreateBackup:=False Application.Dialogs(xlDialogSendMail).Show _ arg1:="email.address", _ arg2:="subject" CloseWorkbook DeleteFile End Sub In arg1 I can specify who receives the e-mail. How can I change it to pick the name from the cell? Another thing is the e-mail address will be the first letter of the first name and ony 7 letters of the last name. ie. if the cell contains the name Fred Bruemmer, the e-mail address would be fbruemme@address.com. We use Lotus Notes as for our e-mail, can I access the address book somehow? Thanks, viper
__________________
I appreciate the help from everyone at Mr. Excel. viper |
|
|
|
|
|
#2 |
|
Board Regular
Join Date: Feb 2002
Location: Guderup, Denmark
Posts: 287
|
Assuming the name is in A1 this change to your code should be enough.
(if you have XL2000) Sub SendIt() N = LCase(Range("a1").Value) EMA = Left(N, 1) & Mid(N, InStrRev(N, " ") + 1, 7) & "@address.com" Application.ScreenUpdating = False Application.DisplayAlerts = False Sheets(1).Copy ActiveWorkbook.SaveAs Filename:="Purchase Journal.xls", _ FileFormat:=xlNormal, Password:="", WriteResPassword:="", _ ReadOnlyRecommended:=True, CreateBackup:=False Application.Dialogs(xlDialogSendMail).Show _ arg1:=EMA, _ arg2:="subject" CloseWorkbook DeleteFile End Sub Regards Tommy |
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Feb 2002
Location: Jefferson City, Missouri
Posts: 383
|
Thank you,
__________________
I appreciate the help from everyone at Mr. Excel. viper |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|