将文本插入收到的电子邮件 Outlook 2013 锁定为只读 [英] Inserting text into incoming email Outlook 2013 locked read only

查看:17
本文介绍了将文本插入收到的电子邮件 Outlook 2013 锁定为只读的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在努力通过 VBA 在收到的电子邮件中插入一个字符串.该例程在发送邮件时工作正常,如果用户单击操作编辑,它将在传入邮件上工作.问题是传入的邮件被锁定为只读模式.在过去的 13.5 小时里,我一直在四处寻找.在早期版本的 Outlook 中是可能的,但是 Microsoft 已经删除了 Office 2013 中的 CommandBar 功能.基本上我需要一种方法来允许通过 VBA 中的设置来编辑邮件.

I'm struggling to insert a string in an incoming email via VBA. The routine works fine when sending mail and it will work on incoming mail if the user clicks Actions Edit. The issue is that incoming mail is locked in read only mode. I've spent the past 13.5 hours searching everywhere. It is possible in earlier versions of Outlook, however Microsoft have removed the CommandBar functionality in Office 2013. Basically I need a way to allow the mail to be editable via a setting in VBA.

这是例程

Sub StampReference()
Dim objOL As Outlook.Application
Dim objNS As Outlook.NameSpace
Dim objDoc As Word.Document
Dim objSel As Word.Selection

strFullReference = "Reference: " & Reference
On Error Resume Next
Set objOL = Application
If objOL.ActiveInspector.EditorType = olEditorWord Then
    Set objDoc = objOL.ActiveInspector.WordEditor
    Set objNS = objOL.Session
    Set objSel = objDoc.Windows(1).Selection
    objSel.Move wdStory, -1
    objDoc.Characters(1).InsertBefore _
      strFullReference & vbCrLf & vbCrLf
    objSel.Move wdParagraph, 1
End If
Set objOL = Nothing
Set objNS = Nothing
End Sub

编辑

我已经破解了!这是为任何感兴趣的人更改模式的方法.它又快又脏,但它显示了它是如何做到的.我拿了一些某人编写的代码来进行重新发送,并尝试使用变体来偶然发现要编辑的正确值.我在标记信息之前调用此例程

I've cracked it! Here is the way to change the mode for anyone interested. It is quick and dirty, however it shows how it can be done. I took some code that someone had written to do a Resend and played around with variants to stumble across the correct value to edit. I call this routine just before stamping the information in

Sub SetEditMode()
Dim myItem As Outlook.MailItem
Dim objInsp As Outlook.Inspector
Dim objActionsMenu As Office.CommandBarControl
Dim olNewMailItem As Outlook.MailItem

On Error Resume Next
Select Case TypeName(Application.ActiveWindow)
    Case "Explorer"
        Set myItem = ActiveExplorer.Selection.Item(1)
        myItem.Display
    Case "Inspector"
        Set myItem = ActiveInspector.CurrentItem
    Case Else
End Select
If myItem Is Nothing Then GoTo ExitProc
'edit mode
Set objInsp = ActiveInspector
objInsp.CommandBars.ExecuteMso ("EditMessage")
objActionsMenu.Execute

ExitProc:
End Sub

推荐答案

我已经破解了!这是为任何感兴趣的人更改模式的方法.它又快又脏,但它显示了它是如何做到的.我拿了一些某人编写的代码来进行重新发送,并尝试使用变体来偶然发现要编辑的正确值.我在标记信息之前调用此例程

I've cracked it! Here is the way to change the mode for anyone interested. It is quick and dirty, however it shows how it can be done. I took some code that someone had written to do a Resend and played around with variants to stumble across the correct value to edit. I call this routine just before stamping the information in

Sub SetEditMode()
Dim myItem As Outlook.MailItem
Dim objInsp As Outlook.Inspector
Dim objActionsMenu As Office.CommandBarControl
Dim olNewMailItem As Outlook.MailItem

On Error Resume Next
Select Case TypeName(Application.ActiveWindow)
    Case "Explorer"
        Set myItem = ActiveExplorer.Selection.Item(1)
        myItem.Display
    Case "Inspector"
        Set myItem = ActiveInspector.CurrentItem
    Case Else
End Select
If myItem Is Nothing Then GoTo ExitProc
'edit mode
Set objInsp = ActiveInspector
objInsp.CommandBars.ExecuteMso ("EditMessage")
objActionsMenu.Execute

ExitProc:
End Sub

user2970334

user2970334

这篇关于将文本插入收到的电子邮件 Outlook 2013 锁定为只读的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆