Hello,
I currently have a UserForm showing when opening a workbook. A copy of this workbook is sent to Outlook with a Macro. The problem I am having is that the UserForm is showing when the copy is made thus requiring the user to close the form before the email is displayed. I don't know where to put the Hide form or me.Unload in the Send to outlook Macro. Any assistance would be greatly appreciated.
Sub MailWorkbookOutlook()
Application.ScreenUpdating = False
If ActiveSheet.Range("N26,W26") = "" Then
MsgBox ("Must enter RENTAL EQUIP & TRAFFIC CONTROL before sending")
Exit Sub
Else
End If
Dim rng As Range
Dim wb1 As Workbook
Dim wb2 As Workbook
Dim FileExtStr As String
Dim OutApp As Object
Dim OutMail As Object
Dim DatePicked As String
Dim PcName As String
Dim ws As Worksheet
Dim strbody As String
DatePicked = ActiveSheet.Range("E23").Value
PcName = ActiveSheet.Range("T13").Value
Set wb1 = ActiveWorkbook
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
With OutMail
.To = "Dailies@bluecomm.com"
.CC = ""
.BCC = ""
.Subject = DatePicked & " - " & PcName
.Body = "CREW MEMBERS ON SITE:" & vbCrLf & "EQUIPMENT ON SITE:" & vbCrLf & vbCrLf & "DESCRIPTION OF TASKS PERFORMED:"
.Attachments.Add wb2.FullName
' In place of the .Send, you can use ".Display" to display the mail.
.Display
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
Application.ScreenUpdating = True
End Sub
I currently have a UserForm showing when opening a workbook. A copy of this workbook is sent to Outlook with a Macro. The problem I am having is that the UserForm is showing when the copy is made thus requiring the user to close the form before the email is displayed. I don't know where to put the Hide form or me.Unload in the Send to outlook Macro. Any assistance would be greatly appreciated.
Sub MailWorkbookOutlook()
Application.ScreenUpdating = False
If ActiveSheet.Range("N26,W26") = "" Then
MsgBox ("Must enter RENTAL EQUIP & TRAFFIC CONTROL before sending")
Exit Sub
Else
End If
Dim rng As Range
Dim wb1 As Workbook
Dim wb2 As Workbook
Dim FileExtStr As String
Dim OutApp As Object
Dim OutMail As Object
Dim DatePicked As String
Dim PcName As String
Dim ws As Worksheet
Dim strbody As String
DatePicked = ActiveSheet.Range("E23").Value
PcName = ActiveSheet.Range("T13").Value
Set wb1 = ActiveWorkbook
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
With OutMail
.To = "Dailies@bluecomm.com"
.CC = ""
.BCC = ""
.Subject = DatePicked & " - " & PcName
.Body = "CREW MEMBERS ON SITE:" & vbCrLf & "EQUIPMENT ON SITE:" & vbCrLf & vbCrLf & "DESCRIPTION OF TASKS PERFORMED:"
.Attachments.Add wb2.FullName
' In place of the .Send, you can use ".Display" to display the mail.
.Display
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
Application.ScreenUpdating = True
End Sub