Emailing a form in VBA

marcusja2002

Board Regular
Joined
Apr 27, 2010
Messages
107
I figured out the code to print the form

DynoFailureReport.PrintForm

The problem is I also want to email the form out as well.

I found this code, but it doesnt seem to view the form as something it can save to a gif to send. How do I code it so it will acknowlwedge the form is what I want to save and in turn email out?

Dim OutApp As Object
Dim OutMail As Object
Dim Fname As String

Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)


'File path/name of the gif file
Fname = Environ$("temp") & "\FailureForm.gif"


'Save Chart sheet named "Chart1" as gif file
ActiveWorkbook.Sheets("DynoFailureReport").Export _
Filename:=Fname, FilterName:="GIF"


On Error Resume Next
With OutMail
.To = "myemail@myemail.com"
.CC = ""
.BCC = ""
.Subject = "Dyno Failure Report"
.Body = "Dyno Failure Report"
.Attachments.Add Fname
.Send 'or use .Display
End With
On Error GoTo 0


'Delete the gif file
Kill Fname


Set OutMail = Nothing
Set OutApp = Nothing
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.

Forum statistics

Threads
1,223,237
Messages
6,170,924
Members
452,366
Latest member
TePunaBloke

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top