2015-03-08 61 views
0

我有一個Outlook 2007加載項目,我嘗試添加一個PropertyPage到。我已實施OptionsPage課程(其實施PropertyPage),該課程在Application.OptionsPagesAdd活動期間添加。Outlook AddIn`PropertyPage`沒有出現在Outlook選項中

Public Class OptionsPage 
    Implements Microsoft.Office.Interop.Outlook.PropertyPage 

    Private Sub Me_Load(sender As Object, e As System.EventArgs) Handles Me.Load 
     System.Windows.Forms.MessageBox.Show("Test Options Loaded") 
    End Sub 

    Public Sub Apply() Implements Microsoft.Office.Interop.Outlook.PropertyPage.Apply 
     ' todo 
    End Sub 

    Public ReadOnly Property Dirty As Boolean Implements Microsoft.Office.Interop.Outlook.PropertyPage.Dirty 
     Get 
      ' todo 
      Return False 
     End Get 
    End Property 

    Public Sub GetPageInfo(ByRef HelpFile As String, ByRef HelpContext As Integer) Implements Microsoft.Office.Interop.Outlook.PropertyPage.GetPageInfo 
     ' todo 
    End Sub 

End Class 
Public Class ThisAddIn 

    Private Sub Application_OptionsPagesAdd(pages As Microsoft.Office.Interop.Outlook.PropertyPages) Handles Application.OptionsPagesAdd 
     pages.Add(New OptionsPage(), "Test Options") 
    End Sub 

End Class 

任何人都可以提出建議,爲什麼我不能得到OptionsPage到Outlook中的選項顯示出來,儘管我沒有得到任何錯誤或運行時異常?

回答

1

事實證明,你需要確保你的類(實現PropertyPage)是爲了其ComVisible屬性True爲它在Outlook中顯示 - 發現in this thread

<System.Runtime.InteropServices.ComVisible(True)> 
Public Class OptionsPage 
    Implements Microsoft.Office.Interop.Outlook.PropertyPage 
End Class 
0

您需要創建一個實現PropertyPage接口的用戶控件。有關更多信息,請參閱How to implement OL PropertyPage with c#

請注意,如果您不瞭解C#,則可以使用automatic language converters來獲取VB.NET代碼。

+0

我'OptionsPage'類是' UserControl'並實現'PropertyPage'。我檢查了鏈接,並沒有提供任何額外的東西,我已經在做。還有其他建議嗎? – 2015-03-09 21:30:27