Aug 17 2021 09:51 AM
Good afternoon
I want to make an excel file to be sent by email to other people, which inside it has a button to send the activebook by email, with the changes that the person has made in the meantime.
I can do it if the person has Outlook installed, but in this case the person can receive on their PC, Tablet or Mobile and I don't know if they have Outllok installed, or which email program they use.
Is there a way in which I know that anyone can receive the file, change the file and by pressing the button, the file is sent by email? Thank you for your help
Aug 17 2021 10:28 AM
E-mail addrese is e-mail addrese, regardless of which software the recipient uses, he should be able to receive an e-mail sent to him. Which software you use to send the e-mail does not matter.
Here is a quick VBA code with which you can send the currently active worksheet. Do not forget to make the desired settings, such as the recipient's email, the body of the email and the subject.
Private Sub CommandButton1_Click()
Dim Nachricht As Object, OutApp As Object
Set OutApp = CreateObject("Outlook.Application")
Dim AWS As String, wksMail As Worksheet
Set wksMail = Sheets(1) ' sheet to be sent
AWS = Environ("USERPROFILE") & "\" & wksMail.Name & ".xls"
'Create a temporary folder
wksMail.Copy
With ActiveWorkbook
.SaveAs AWS
.Close
End With
Application.Visible = True
Set Nachricht = OutApp.CreateItem(0)
With Nachricht
.To = "@Nikolino.de" ‘insert the desired e-mail address.
.Cc = ""
.Subject = "Please complete with your text " & Date & Time
.Attachments.Add AWS
.Body = "Enclosed data " & vbCrLf & ""
.Display
End With
Set OutApp = Nothing
Set Nachricht = Nothing
Kill AWS 'Delete temporary folder
End Sub
I would be happy to know if I could help.
NikolinoDE
I know I don't know anything (Socrates)
* Kindly Mark and Vote this reply if it helps please, as it will be beneficial to more Community members reading here.