Outlook 电子邮件中的文本框 [英] Text Box in Outlook Email

查看:150
本文介绍了Outlook 电子邮件中的文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下是两组删除文本框的 VBA 代码,第一组适用于 MS Excel,第二组适用于 MS Word.两者唯一的区别是Active"之后的第三行.

Below are two sets of VBA code that deletes text boxes, the first one works in MS Excel and the second in MS Word. The only difference between the two is the third line after "Active".

我正在尝试在一封新打开的电子邮件中在 MS Outlook 中复制此操作,但缺乏正确的代码术语知识...有没有人知道这个问题的答案?...谢谢,.

I'm trying to duplicate this action in MS Outlook in a new-opened email but lack the knowledge of the proper code terminology... is there anyone out there that knows the answer to this?... thank you,.

Sub RemoveTextBox()
    Dim shp As Shape
    For Each shp In ActiveSheet.Shapes
        If shp.Type = msoTextBox Then shp.Delete
    Next shp
End Sub

<小时>

Sub RemoveTextBox()
    Dim shp As Shape
    For Each shp In ActiveDocument.Shapes
        If shp.Type = msoTextBox Then shp.Delete
    Next shp
End Sub

推荐答案

对于 Outlook,它将类似于以下示例

Option Explicit
Public Sub Example()
    Dim Inspector As Outlook.Inspector
    Dim wdDoc As Word.Document
    Dim Shp As Word.Shape

    Set Inspector = Application.ActiveInspector()
    Set wdDoc = Inspector.WordEditor

    For Each Shp In wdDoc.Shapes

        Debug.Print Shp.Type 'msoTextBox = 17 - Print on Immediate Window
        If Shp.Type = msoTextBox Then Shp.Delete

    Next

End Sub

对于使用 Application.ActiveInspector 方法(Outlook)Inspector.WordEditor 属性(Outlook)

Inspector.WordEditor 属性(Outlook) 返回所显示消息的 Microsoft Word 文档对象模型.只读,仅当 IsWordMail 方法返回 True 且 EditorType 属性为 olEditorWord 时,WordEditor 属性才有效.返回的 WordDocument 对象提供对大多数 Word 对象模型的访问,但以下成员除外:

Application.ActiveInspector 方法(Outlook) 返回最顶层的Inspector 桌面上的对象.

<小时>

记得添加对单词xx的引用对象库

1.从工具"菜单中,选择引用"以显示引用"对话框.

2.引用"对话框显示在操作系统中注册的所有对象库.滚动浏览要引用其对象库的应用程序的列表.如果应用程序未列出,您可以使用浏览"按钮搜索对象库(.olb 和 .tlb)或可执行文件(.exe 和 .dll视窗).您的项目使用了复选框被选中的引用;未勾选的不使用,但可以添加.

2. The References dialog box shows all object libraries registered with the operating system. Scroll through the list for the application whose object library you want to reference. If the application isn't listed, you can use the Browse button to search for object libraries (.olb and .tlb) or executable files (.exe and .dll on Windows). References whose check boxes are checked are used by your project; those that aren't checked are not used, but can be added.

这篇关于Outlook 电子邮件中的文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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