gpt4 book ai didi

excel - 如何在字符串中调用单元格值?

转载 作者:行者123 更新时间:2023-12-04 20:29:17 25 4
gpt4 key购买 nike

我正在尝试设置一个宏来发送电子邮件,在截止日期时间表上更新人们。此电子邮件应从特定单元格中提取日期并将其放入邮件正文中。到目前为止,我可以设置电子邮件以按照我想要的方式阅读,但在调用日期时遇到了麻烦。

我是 vba 的 super 新手,这可能不是一个可行的功能,但任何解决方法都将不胜感激!谢谢!

Dim OutApp As Object
Dim OutMail As Object
Dim strbody As String

Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)

Dim rev_1 As Date, rev_2 As Date, final_due As Date
rev_1 = Range(I2)
rev_2 = Range(K2)
final_due = Range(M2)

strbody = "XXXXXXX" & vbNewLine & vbNewLine & _
"This is an update on your project dates:" & vbNewLine & vbNewLine & _
"Review 1 Suspense: CALL CELL I2 HERE" & vbNewLine & _
"Review 2 Suspense: CALL CELL K2 HERE" & vbNewLine & _
"Final Due Date: CALL CELL M2 HERE" & vbNewLine & vbNewLine & _
"Acoording to this timeline, you are AHEAD/ON TIME/BEHIND." & vbNewLine & vbNewLine & _
"If you have any questions, please contact XXXX." & vbNewLine & vbNewLine & _



On Error Resume Next
With OutMail
.To = ""
.CC = ""
.BCC = ""
.Subject = "Upcoming Project - Timeline Update"
.Body = strbody
.Display
End With
On Error GoTo 0

Set OutMail = Nothing
Set OutApp = Nothing

结束子

最佳答案

你好,你可以这样做

"Review 1 Suspense: " & range("I2") & vbNewLine & _

关于excel - 如何在字符串中调用单元格值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53068769/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com