33、Excel与Outlook、Access的协同操作指南

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 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值