sspatriots
Well-known Member
- Joined
- Nov 22, 2011
- Messages
- 585
- Office Version
- 365
- Platform
- Windows
I've been getting this code closer to what I need it to do, however, after it runs and puts a snapshot of a filtered selection in an e-mail, I cannot get it to return to the workbook and turn off the filtered item. It stays selected and highlighted. The code right now is shown below:
Sub SendEmailJohnDoe()
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
JohnDoe
On Error Resume Next
With OutMail
.To = "JohnDoe@gmail.com"
.CC = "JaneDoe@gmail.com"
.Subject = "Update to your PO(s)"
.Body = ""
.Display
End With
SendKeys "^v"
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
Sub JohnDoe()
'
' JHM Macro
'
'
Sheets("LogDetails").Select
ActiveSheet.Range("$A$1:$O$100").AutoFilter Field:=10, Criteria1:="JHM"
Range("G1:O20").Select
Selection.Copy
End Sub
I need this to run, let me send the e-mail (that part works), then return to the spreadsheet and turn the filter off for "JHM". The Range is an issue too because I only want the range to the end of the filtered cells that go into the e-mail. Years ago, I had code that did all this, but I'm sure that is still with that employer. So starting over.
Sub SendEmailJohnDoe()
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
JohnDoe
On Error Resume Next
With OutMail
.To = "JohnDoe@gmail.com"
.CC = "JaneDoe@gmail.com"
.Subject = "Update to your PO(s)"
.Body = ""
.Display
End With
SendKeys "^v"
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
Sub JohnDoe()
'
' JHM Macro
'
'
Sheets("LogDetails").Select
ActiveSheet.Range("$A$1:$O$100").AutoFilter Field:=10, Criteria1:="JHM"
Range("G1:O20").Select
Selection.Copy
End Sub
I need this to run, let me send the e-mail (that part works), then return to the spreadsheet and turn the filter off for "JHM". The Range is an issue too because I only want the range to the end of the filtered cells that go into the e-mail. Years ago, I had code that did all this, but I'm sure that is still with that employer. So starting over.