I have the following macro, which contains a Msgbox. I would like a delay to allow the user to first enter the month and years and once entered then macro to continue
It would be appreciated if someone could amend my code
It would be appreciated if someone could amend my code
Code:
Sub Email_Reports()
With Range("B6")
MsgBox ("Enter the TB extraction month and year, for e.g. March 2020")
End With
Dim FileArr, i As Long
Application.ScreenUpdating = False
With Application.FileDialog(msoFileDialogFilePicker)
.InitialFileName = "C:\Pull"
If .Show = -1 Then
ReDim FileArr(1 To .SelectedItems.Count)
For i = 1 To .SelectedItems.Count
FileArr(i) = .SelectedItems(i)
Next i
Else
MsgBox "NO FILES SELECTED", vbInformation, ""
Exit Sub
End If
End With
With CreateObject("outlook.application").CreateItem(0)
.Display
.To = Join(Application.Transpose(Range("E1:E2").Value), ";")
.Subject = "Sales Report for " & Range("b6") & ""
For i = 1 To UBound(FileArr)
.Attachments.Add FileArr(i)
Next i
.HTMLbody = "Hi " & Range("D1") & "<br><br>" & "Attached please find Sales report for " & Range("b6") & "." & "<br><br>" & "Regards" & "<br><br>" & "Howard"
.Display 'Change to Send after testing
End With
Application.ScreenUpdating = True
End Sub