当发送到Outlook电子邮件时,时间格式为小时:分钟更改为例如0.463
Private Sub CommandButton1_Click()
Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)
EndDate = ActiveCell.Value
With OutMail
.To = "Enter Specific contact email address"
.CC = ""
.BCC = ""
.Subject = "Enter subject, along the lines of Reminder, due to end etc."
.body = EndDate
.Display
End With
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
答案 0 :(得分:0)
您只需要将主体更改为您想要的格式即可。看下面:
.body = Format(EndDate, "HH:MM")
这是唯一需要改变的事情。您可以参考here了解其他可用格式,例如"HH:MM AMPM"
。
P.S。
@ScottCraner提出的建议(EndDate = ActiveCell.Text
)也有效。但我个人更喜欢第一种解决方案,因为它可以让您在必要时对EndDate
变量执行计算。