Show Fridays date on monday

J

John

I have a VB code that will stamp the previous days date in the subject of an
e-mail. But on Monday I need it to post Friday's date. How can I do this?

Here is the code that I currently have.

..Subject = "PKG Results - " & Format(Now() - 1, "dddd, mmmm dd,yyyy")

Thank you for your help.
 
P

Paul

John

Do you really want Friday to be the hard-coded day or are you after the
previous working day ?
 
S

Sam Wilson

if day(now) = 2 then
.subject = "PKG Results - " & Format(Now() - 3, "dddd, mmmm dd,yyyy")
else
.subject = "PKG Results - " & Format(Now() - 1, "dddd, mmmm dd,yyyy")
end if
 
M

Mike H

John,

Try this

If Weekday(Now) = 2 Then
Mydate = Now - 3
Else
Mydate = Now - 1
End If
..Subject = "PKG Results - " & Format(Mydate, "dddd, mmmm dd,yyyy")

Mike
 
R

Rick Rothstein

Try it this way...

..Subject = "PKG Results - " & Format(Now - 1 + 2 * (Weekday(Now) = 2), "dddd, mmmm dd,yyyy")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top