如何以编程方式打开Outlook快捷方式 [英] How to programmatically open an Outlook Shortcut
问题描述
我想知道是否可以通过编程方式从我的插件中打开Outlook快捷方式.
I'm wondering if there is a way of programmatically opening an Outlook Shortcut from my addin.
我创建了如下快捷方式
Sub AddShortcut()
Dim myOlBar As Outlook.OutlookBarPane
Dim myolGroup As Outlook.OutlookBarGroup
Dim myOlShortcuts As Outlook.OutlookBarShortcuts
myOlBar = Application.ActiveExplorer.panes.Item("OutlookBar")
myolGroup = myOlBar.Contents.Groups.Item(1)
myOlShortcuts = myolGroup.Shortcuts
myOlShortcuts.Add("http://microsoft.com/", _
"MSHomepage", 1)
End Sub
我猜我需要以某种方式使用InvokeMember
I'm guessing I need to use InvokeMember
in some way
myOlShortcuts("MSHomepage").GetType().InvokeMember(..)
但是当我使用GetType().GetMethods()
时,我看不到任何Click
成员或类似的东西.非常感谢您的帮助.
But when I use GetType().GetMethods()
I can't see any Click
members or something similar. Any help is very much appreciated.
推荐答案
如果要触发Outlook集成的Web浏览器,则应获取 string
,则使用以下内容(将目标目标"替换为文本" )...
If you want to trigger the Outlook integrated web browser, you should grab the OutlookBarShortcut.Target
. If the Target is of type string
, then use the following (substituting your Target for the address Text)...
Office.CommandBarComboBox address = (Office.CommandBarComboBox)Application.ActiveExplorer().CommandBars.FindControl(26, 1740);
address.Text = "http://www.stackoverflow.com";
否则类型为Folder
,您应该分配 Explorer.CurrentFolder
.此方法的唯一缺点是 CommandBars
已被Outlook 2010弃用,并且此解决方案可能无法在下一版Office中使用.
otherwise the type is Folder
and you should assign Explorer.CurrentFolder
. The only downside with this approach is that CommandBars
have been deprecated with Outlook 2010 and this solution likely won't work in the next version of Office.
另一种替代方法是使用 Web文件夹行为,如本SO帖子中所述.您可以创建仅用于导航目的的隐藏Folder
.
Another alternative is to use Web Folder behavior as discussed in this SO post. You could create a hidden Folder
used just for the purposes of navigation.
这篇关于如何以编程方式打开Outlook快捷方式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!