Good Day
MY current VBA
I have the following VBA that saves a copy of the active sheet and emails it to a specific email address.
I have tried to add to the vba to tell it what sheets I want it to the active sheet to be or change the active sheet to the specific sheet i need emailed.
I will need 5 macros 1 for each manager as each one of them has to get different sheets as in picture
So Jaques needs to get an workbook emailed to him consisting of sheet 1-13 etc etc
MY current VBA
VBA Code:
Sub send_email()
Dim wPath As String, wFile As String
Dim FName As String
Dim FPath As String
Dim wbkExport As Workbook
Dim shtToExport As Worksheet
FPath = "[URL]https://xxxxxxxxxxxxxxx/[/URL]"
FName = Range("d1").Value
[COLOR=rgb(97, 189, 109)]Dim s As Long
For s = 1 To 13
Sheets(s).Activate[/COLOR]
[COLOR=rgb(97, 189, 109)]Next s[/COLOR]
(i added this in green and dont think its working)
Set shtToExport = ActiveSheet
Set wbkExport = Application.Workbooks.Add
shtToExport.Copy Before:=wbkExport.Worksheets(wbkExport.Worksheets.Count)
Application.DisplayAlerts = False
wbkExport.SaveAs Filename:=FPath & "\" & FName & ".xlsx"
Application.DisplayAlerts = True
wbkExport.Close SaveChanges:=False
Set dam = CreateObject("Outlook.Application").CreateItem(0)
'
dam.To = "lXXXXXXXX"
dam.Subject = Range("d1")
dam.Body = "Hi Please Find Attached Weekly Dashboard"
dam.Attachments.Add FPath & FName & ".xlsx"
dam.send
MsgBox "Email sent"
End Sub
I have the following VBA that saves a copy of the active sheet and emails it to a specific email address.
I have tried to add to the vba to tell it what sheets I want it to the active sheet to be or change the active sheet to the specific sheet i need emailed.
I will need 5 macros 1 for each manager as each one of them has to get different sheets as in picture
So Jaques needs to get an workbook emailed to him consisting of sheet 1-13 etc etc
Last edited by a moderator: