我遇到了这个问题,我尝试了很多东西但没有工作。 我想用这个宏发送电子邮件,我可以发送电子邮件,但电子邮件正文不包括名为" permit"的变量值。我有columnC上的许可列表,电子列列列和列G上的余数列表。当我运行这个宏电子邮件是完美的,但许可证不附加身体,我想将每个许可证发送到后面的电子邮件行。有什么帮助吗?
Sub SendReminderMail()
Dim OutLookApp As Object
Dim OutLookMailItem As Object
Dim iCounter As Integer
Dim MailDest As String
Cells(iCounter & "C").Select
Dim permit As String
permit = Cells(iCounter & "C").Value
Set OutLookApp = CreateObject("Outlook.application")
Set OutLookMailItem = OutLookApp.CreateItem(0)
With OutLookMailItem
MailDest = ""
For iCounter = 2 To WorksheetFunction.CountA(Columns(5))
If MailDest = "" And Cells(iCounter, 5).Offset(0, 2) = "Send Reminder" Then
MailDest = Cells(iCounter, 5).Value
ElseIf MailDest <> "" And Cells(iCounter, 5).Offset(0, 2) = "Send Reminder" Then
MailDest = MailDest & ";" & Cells(iCounter, 5).Value
End If
Next iCounter
.BCC = MailDest
.Subject = "Soon to Expire"
.Body = "Reminder: Your Permit is about to expire Permit#" & permit
'here is the part where i want my permit variables to attach
.Send
End With
Set OutLookMailItem = Nothing
Set OutLookApp = Nothing
End Sub
答案 0 :(得分:0)
使用
library(lubridate)
df <- data.frame(
date = today() + days(1:300),
category = c("A","B","c"),
amt = runif(300)
)
df2017_secondHalf <- subset(df, month(df$date) %in% c(7,8,9,10,11,12) & year(df$date) == 2017)
f2018_firstHalf <- subset(df, month(df$date) %in% c(1,2,3,4,5,6) & year(df$date) == 2018)
sum1 <- aggregate(df2017_secondHalf$amt, by=list(Category=df2017_secondHalf$Category), FUN=sum)
sum2 <- aggregate(df2018_firstHalf$amt, by=list(Category=df2018_secondHalf$Category), FUN=sum)
df2017_secondHalf$period <- '2017_secondPeriod'
df2018_firstHalf$period <- '2018_firstPeriod'
aggregate(x = df$amt, by = df[c("period", "category")], FUN = sum)
或
permit = Cells(iCounter, "C").Value
看到细微差别?