Send Email With Signature VBA (EDITING A VBA CODE)

Youseepooo

New Member
Joined
Feb 5, 2019
Messages
37
Hello,
With some help from a fellow forum user i have this code:

1) The issues are i want it to save the file name as "x" which is tomorrows date and save it in a network shared folder.

2) i also want to include a image for my company logo after my position. in the body of the email which i highlighted in blue.



Thank You Very Much!!!

Sub Send_Email()
Dim wPath As String, wFile As String
Dim x As Date
x = Format(Now() + 1, "MMMM dd, yyyy")
wPath = ThisWorkbook.Path
wFile = "Daily Look Ahead.pdf"
Range("B1:I47").ExportAsFixedFormat Type:=xlTypePDF, Filename:=wPath & wFile, _
Quality:=xlQualityStandard, IncludeDocProperties:=True, _
IgnorePrintAreas:=False, OpenAfterPublish:=False




Set dam = CreateObject("Outlook.Application").CreateItem(0)
'
dam.To = "ymussa@gmail.com"
dam.cc = "jsilko@gmail.com"
dam.Subject = "Daily Schedule for " & x
dam.body = "Hello all," & vbNewLine & vbNewLine _
& "The Daily Look Ahead Schedule for " & x & " is attached." & vbNewLine & vbNewLine & vbNewLine & vbNewLine _
& "Thank You" & vbNewLine & "Name" & vbNewLine & "Position" & vbNewLine & "Test Sent with VBA"
dam.Attachments.Add wPath & wFile
dam.Send
MsgBox "Email sent"




End Sub
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
is there any way to add a if statement to the variable "x". because on friday the daily report will read next days dat but techically if its friday then i need it to do it ad now()+2 instead of the regular x date.

Thanks I promise this will be the last thing :) !
 
Upvote 0
When the date is a Friday, now() +2 will make it a Sunday. Is this what you want? Or did you mean now(()+3, which would make it a Monday?
 
Upvote 0
The WorkdDay method of the WorksheetFunction object can be used...

Code:
    Dim wf As WorksheetFunction
    
    Set wf = Application.WorksheetFunction
    
    x = Format(wf.WorkDay(Date, 1), "MMMM dd, yyyy")

Note that the WorkDay method contains a third parameter, which allows one to exclude holidays. Have a look at the following link for more information...

https://docs.microsoft.com/en-us/office/vba/api/excel.worksheetfunction.workday
 
Upvote 0

Forum statistics

Threads
1,223,264
Messages
6,171,081
Members
452,377
Latest member
bradfordsam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top