You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用Redemption修改Outlook回复签名时遇类型不匹配错误求助

解决Redemption设置Outlook回复签名的类型不匹配错误

错误原因

Account.ReplySignature属性接收的是RDOEmailSignature对象,而非直接的签名名称字符串,直接赋值字符串会触发"Type Mismatch"错误。

修正后的代码

Sub Change_Signature()
    Dim Session As Object
    Dim Account As Variant
    Dim targetSignature As Object
    
    Set Session = CreateObject("Redemption.RDOSession")
    Session.MAPIOBJECT = Application.Session.MAPIOBJECT
    
    ' 获取第一个邮件账户
    Set Account = Session.Accounts.GetOrder(2).Item(1)
    ' 根据签名名称获取对应的RDOEmailSignature对象
    Set targetSignature = Session.Signatures("Microsoft")
    
    ' 赋值签名对象并保存账户设置
    If Not targetSignature Is Nothing Then
        Set Account.ReplySignature = targetSignature
        Account.Save
    Else
        MsgBox "未找到名为'Microsoft'的签名"
    End If
End Sub

关键说明

  • 先通过Session.Signatures("签名名称")获取目标签名的对象实例,再赋值给Account.ReplySignature
  • 增加了签名存在性判断,避免因签名名称错误导致的额外报错

内容的提问来源于stack exchange,提问作者Leedo

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.05 17:40:31