Hi All,
i am trying to automate the reports. I got the below code from online and its working fine.But i would like to make changes and i am not sure how to do it.
Below macro refresh the data and Email it. What happeining is the excel with all the macros and formulas is also being send. How can i make sure that the excel with only values should be Emailed(No formulas and No macros).
Sub OC()
'
' OC Macro
Sheets("Sheet1").Select
Range("A3").Select
Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
ActiveWindow.Close
Range("A4").Select
Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
ActiveWindow.Close
Sheets("EOD Report").Select
ActiveWindow.SmallScroll Down:=-18
Range("A1").Select
Dim FileExtStr As String
Dim FileFormatNum As Long
Dim Sourcewb As Workbook
Dim Destwb As Workbook
Dim TempFilePath As String
Dim TempFileName As String
Dim OutApp As Object
Dim OutMail As Object
With Application
.ScreenUpdating = False
.EnableEvents = False
End With
Set Sourcewb = ThisWorkbook
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
With OutMail
.To = "My Email"
.CC = ""
.BCC = ""
.Subject = "EOD Report"
.Body = "Hi Team,Please find attached EOD Report"
.Attachments.Add "file path"
.Send
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
With Application
.ScreenUpdating = True
.EnableEvents = True
End With
End Sub
Please help.
Bookmarks