Vba代码从outlook addin中选择值 [英] Vba code to select value from outlook addin

查看:111
本文介绍了Vba代码从outlook addin中选择值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨朋友们,



我有以下VBA从outlook发送邮件但我无法弄清楚选择'分类的代码:受限制的'(这个加入是由客户开发的,加入称为IC labeeling addin并添加到outlook Ribbon)。



有人可以帮助我代码,从outlook Ribbon中选择值?





先谢谢。



我尝试过:



  Sub  CreateMail()
Dim rng As 范围
rowN = ThisWorkbook.Sheets( Impact Analysis)。Cells(Rows.Count, 7 )。结束(xlUp)。
设置 rng = ThisWorkbook.Sheets( 影响分析)。范围( C6:G& rowN)
Dim OutApp
设置 OutApp = CreateObject( Outlook.Application
设置 OutMail = OutApp.CreateItem( 0
使用 OutMail
To = karthickonmail@gmail.com
' 。CC =
' 。BCC =
.Subject = 表更改影响请查看。

.HTMLBody = 以下对表格进行了更改,请执行regr激情测试& vbCrLf& RangetoHTML(rng)_
& vbCrLf& 更改原因:

。发送
结束 使用

解决方案

< blockquote>你可以像这样使用Outlook对象模型的PropertyAccessor:



  Set  oPA = oMail.PropertyAccessor 
oPA.SetProperty myProp,myValue





我只是不知道的价值受限制属性,但如果您首先使用此属性创建邮件,然后阅读已分配属性的列表,您将找到所需的值。也许它被合并在'flags'属性中 - 在这种情况下将它分开可能有点困难。



祝你好运!


Hi Friends,

I have the below VBA to send mail from outlook but I am unable to figure out the piece of code that would select the 'classification: Restricted' (This add in was developed by client and the add in called as IC labeeling addin and added to outlook Ribbon).

Can some one please help me with the code, to select the value from outlook Ribbon?


Thanks in Advance.

What I have tried:

Sub CreateMail()
    Dim rng As Range
    rowN = ThisWorkbook.Sheets("Impact Analysis").Cells(Rows.Count, 7).End(xlUp).Row
    Set rng = ThisWorkbook.Sheets("Impact Analysis").Range("C6:G" & rowN)
    Dim OutApp
    Set OutApp = CreateObject("Outlook.Application")
    Set OutMail = OutApp.CreateItem(0)
    With OutMail
        .To = "karthickonmail@gmail.com"
        '.CC = ""
        '.BCC = ""
        .Subject = "Table change impact please review."

        .HTMLBody = "The below changes has been made to the tables,please perform the regression testing" & vbCrLf & RangetoHTML(rng) _
        & vbCrLf & "Reason for Change:"

        .Send
    End With

解决方案

You may use the PropertyAccessor of Outlook's object model like this:

Set oPA = oMail.PropertyAccessor 
 oPA.SetProperty myProp, myValue



I just don't know the value for the 'restricted' property but if you first create a mail with this property and then read the list of assigned properties, you'll find the required value. Maybe it is combined within the 'flags' property - in this case it may be a little more difficult to separate it.

Good luck!


这篇关于Vba代码从outlook addin中选择值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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