Just a quickie, I have created a form on Excel which when completed by the recipitant is mailed back to me via a button which I have placed on the form and written the macro for.
What I wondered was you might know how I can get the users' e-mail address. So that when they click the send button on the form and then message is sent from excel with the form attached can you make it so that a cell (e.g. Range “A1”) contains the senders email address?
Sub SendEmail()
ESubject = "This is a test email"
SendTo = "name.surname@mycompany.come"
Ebody = "Testing VBA's ability to send an email."
NewFileName = "C:\My Documents\TestFile.xls"
Set App = CreateObject("Outlook.Application")
'Update Range("A1) with Sender's email address goes here
Set itm = App.CreateItem(0)
With itm
.Subject = ESubject
.To = SendTo
.Body = Ebody
.Attachments.Add (NewFileName)
.send
End With
Set App = Nothing
Set itm = Nothing
End Sub
What I wondered was you might know how I can get the users' e-mail address. So that when they click the send button on the form and then message is sent from excel with the form attached can you make it so that a cell (e.g. Range “A1”) contains the senders email address?
Sub SendEmail()
ESubject = "This is a test email"
SendTo = "name.surname@mycompany.come"
Ebody = "Testing VBA's ability to send an email."
NewFileName = "C:\My Documents\TestFile.xls"
Set App = CreateObject("Outlook.Application")
'Update Range("A1) with Sender's email address goes here
Set itm = App.CreateItem(0)
With itm
.Subject = ESubject
.To = SendTo
.Body = Ebody
.Attachments.Add (NewFileName)
.send
End With
Set App = Nothing
Set itm = Nothing
End Sub