Excel与Outlook、Access的协同操作指南
1. Excel与Outlook的交互
在Excel中,我们可以借助VBA宏与Outlook进行交互,实现邮件的创建和发送等功能。以下为几种常见的应用场景及代码示例:
1.1 整合代码示例
下面的宏将之前的代码示例整合在一起,运行名为 ExampleEmail 的宏后,你可以看到在Outlook 2013中邮件的样子。
Sub ExampleEmail()
'Declare the Object variables for Outlook.
Dim objOutlook As Object
'Verify Outlook is open.
On Error Resume Next
Set objOutlook = GetObject(, "Outlook.Application")
'If Outlook is not open, end the Sub.
If objOutlook Is Nothing Then
Err.Clear
MsgBox "Cannot continue -- Outlook is not open.", , _
"Please open Outlook and try again."
Exit Sub
'Outlook is determined to be open, so OK to proceed.
Else
'Declare a
超级会员免费看
订阅专栏 解锁全文

419

被折叠的 条评论
为什么被折叠?



