如何确定当前周数?
How to determine the current week number?
我的目标是将当前周数放在外发邮件的主题中。
下面给我这周+1。
以前是2016,现在是365,问题依旧
我试过 Format(Now - 1, "ww")
但它没有给出当前周 - 1 周,我的逻辑是 Format(Now - 1, "YYYY-MM-DD") 输出今天 - 一天的日期.
Sub SendMail()
Dim olApp As Outlook.Application
Dim olEmail As Outlook.MailItem
Set olApp = New Outlook.Application
Set olEmail = olApp.CreateItem(olMailItem)
With olEmail
.BodyFormat = olFormatHTML
.Display
'.HTMLBody = "<p style=font-size:11pt;font-family:Calibri>Text here, but deleted in this moment..</p>" & .HTMLBody
'.Attachments.Add "C:\temp\Bok1.xlsx"
'.To = ""
.Subject = "v" & Format(Now - 1, "ww") & " - PR11"
'.Send
End With
Set olApp = Nothing
Set olEmail = Nothing
End Sub
Format
有可选参数:
FirstDayOfWeek
FirstWeekOfYear
根据评论,您似乎在寻找:
Format(Date, "ww",,vbFirstFullWeek)
其中 vbFirstFullWeek
表示:
Start with the first full week of the year.
我的目标是将当前周数放在外发邮件的主题中。
下面给我这周+1。
以前是2016,现在是365,问题依旧
我试过 Format(Now - 1, "ww")
但它没有给出当前周 - 1 周,我的逻辑是 Format(Now - 1, "YYYY-MM-DD") 输出今天 - 一天的日期.
Sub SendMail()
Dim olApp As Outlook.Application
Dim olEmail As Outlook.MailItem
Set olApp = New Outlook.Application
Set olEmail = olApp.CreateItem(olMailItem)
With olEmail
.BodyFormat = olFormatHTML
.Display
'.HTMLBody = "<p style=font-size:11pt;font-family:Calibri>Text here, but deleted in this moment..</p>" & .HTMLBody
'.Attachments.Add "C:\temp\Bok1.xlsx"
'.To = ""
.Subject = "v" & Format(Now - 1, "ww") & " - PR11"
'.Send
End With
Set olApp = Nothing
Set olEmail = Nothing
End Sub
Format
有可选参数:
FirstDayOfWeek
FirstWeekOfYear
根据评论,您似乎在寻找:
Format(Date, "ww",,vbFirstFullWeek)
其中 vbFirstFullWeek
表示:
Start with the first full week of the year.