Good Morning Helpful Excel Peeps
I have an excel file that will be posted on a website for an individual to fill out. I want them to click a button (which I have created) and email the excel file to a specific email address.
I have created this but my problem is, that the macro I am using only wants to send through Outlook and not everyone has outlook.
Here is the Macro I came up with. Any help would be greatly appreciated
I have an excel file that will be posted on a website for an individual to fill out. I want them to click a button (which I have created) and email the excel file to a specific email address.
I have created this but my problem is, that the macro I am using only wants to send through Outlook and not everyone has outlook.
Here is the Macro I came up with. Any help would be greatly appreciated
VBA Code:
Sub EmailRegistration()
Dim oApp As Object
Dim oMail As Object
Dim LWorkbook As Workbook
Dim LFileName As String
'Turn off screen updating
Application.ScreenUpdating = False
'Copy the active worksheet and save to a temporary workbook
ActiveSheet.Copy
Set LWorkbook = ActiveWorkbook
'Create a temporary file in your current directory that uses the name
' of the sheet as the filename
LFileName = LWorkbook.Worksheets(1).Name & " " & Format(Now, "dd-mmm-yy h-mm-ss")
On Error Resume Next
'Delete the file if it already exists
Kill LFileName
On Error GoTo 0
'Save temporary file
LWorkbook.SaveAs Filename:=LFileName
'Create an Outlook object and new mail message
Set oApp = CreateObject("Outlook.Application")
Set oMail = oApp.CreateItem(0)
'Set mail attributes (uncomment lines to enter attributes)
' In this example, only the attachment is being added to the mail message
With oMail
.To = "EMAIL ADDRESS GOES HERE"
.Subject = "Endless Dulcimer Registration 2022"
.body = "Please see the attached completed registration for the upcoming event." & vbCrLf & vbCrLf & _
"Attached is the file"
.Attachments.Add LWorkbook.FullName
.Display
End With
End Sub