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
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