vba - 在列中发送时如何取消vba的运行
问题描述
我有以下内容,如果“已发送”在 L 列中,我希望它不填充邀请。目的不是让一些邀请发送两次,如何实现?
Dim OutApp As Object
Dim OutMail As Object
Dim Cell As Range
Application.ScreenUpdating = False
Set OutApp = CreateObject("Outlook.Application")
For Each Cell In Worksheets("Scheduler").Range("H2:H50").Cells
Set OutMail = OutApp.CreateItem(1)
If Cell.Value Like "*@*" Then 'try with less conditions first
With OutMail
.MeetingStatus = olMeeting
.RequiredAttendees = Cells(Cell.Row, "H").Value
.Subject = Cells(Cell.Row, "I").Value
.Body = Cells(Cell.Row, "J").Value
.Start = Cells(Cell.Row, "E").Value
.Location = "Zoom Meeting"
.Duration = Cells(Cell.Row, "F").Value
.BusyStatus = 1.5 ' set as Busy
.ReminderSet = True 'reminder set
.ReminderMinutesBeforeStart = "15" 'reminder 2 weeks before
.Display
End With
Cells(Cell.Row, "L").Value = "sent"
Set OutMail = Nothing
End If
Next Cell
Application.ScreenUpdating = True
结束子
解决方案
一开始只是Cells(Cell.Row, "L").Value
检查sent
。
For Each Cell In Worksheets("Scheduler").Range("H2:H50").Cells
If Cells(Cell.Row, "L").Value <> "sent" then
Set OutMail = OutApp.CreateItem(1)
If Cell.Value Like "*@*" Then
'... Rest of your code
End if
next Cell
这样,仅处理 L 列中的值未“发送”的行。
推荐阅读
- android - 无法在android中解析符号'github'
- assembly - 显示汇编代码的 cpu 周期和延迟的分析器工具
- sql - 如何在 Azure SQL 或 Azure CosmosDB 上存储来自 REST API 调用的 GET 请求
- reactjs - 什么是本地主机 3000?
- python - 如何使用 python 获得像地图一样的二维泰拉瑞亚
- visual-studio - 目标框架未在“Visual Studio”中显示“.NET Core 3.1”
- javascript - 在 Laravel 中使用 AJAX GET 方法发送请求
- python - 如何从机器人框架中删除解析错误
- python - 从 python 脚本运行 C++ 可执行文件
- arrays - 在具有不同输出文件linux的多个文件上运行数组