want to hide bcc field in outlook 2010 email using vba

岁酱吖の 提交于 2020-01-16 01:22:02

问题


I'm trying to hide the Bcc field in an email that's currently being drafted in Outlook 2010 using VBA. The reason to hide it is that I'm using code to add an email address to Bcc which shows the field, but then I want the real-estate on the screen back.

Here's what I have so far (in ThisOutlookSession):

    Sub add_bcc_to_cur_email()
        Dim cur_msg As MailItem
        Set cur_msg = ActiveInspector.CurrentItem
        cur_msg.BCC = "first.last@domain.com" 'this works correctly
        cur_msg.GetInspector.CommandBars.ExecuteMso "Bcc" 'this does nothing
    End Sub

The first tree I barked up was thinking there was a way to control the visibility of the Bcc field directly, so I searched for information on that, and I found this page -- The second post seemed to have a solution, but that was for 2003, and alas, did not work.

Then I thought I could try to launch the Bcc item in the Ribbon which is located here: Options > Show Fields > Bcc. So I googled how to launch an item in the Ribbon, and came up with this page which had some interesting code, but the thread seemed to be inconclusive.

So either way -- Does anyone have any ideas? :)

Happy New Year, and thank you so much in advance~


回答1:


This worked for me in 2010

cur_msg.GetInspector.Commandbars("Menu Bar").Controls("View").controls("Bcc Field").execute


来源:https://stackoverflow.com/questions/20911538/want-to-hide-bcc-field-in-outlook-2010-email-using-vba

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!