こんにちは、予定タブに新しいカスタマイズされたトグル ボタンを追加したい Outlook のアドインを開発しています。予定を保存するときに、トグル ボタンの現在の状態を取得したいと考えています。これまでの私のコードは次のとおりです。
ボタンはすでに作成されていますが、保存を押してもボタンコントロールを取得できません。リボン 1.xml:
<tab idMso="TabAppointment">
<group id="SalesforceGroup" label="Salesforce">
<toggleButton id="ImportToSalesforce" size="large"
label="Import to Salesforce" imageMso="DatabaseInsert"
getPressed="GetPressed"
onAction="Salesforce_Click" />
</group>
</tab>
リボン 1.vb:
Public Sub GetPressed(ByVal control As Office.IRibbonControl)
MsgBox("test") ' This alert only pops up when the appointment window opens
End Sub
Public Sub Salesforce_Click(ByVal control As Office.IRibbonControl)
MsgBox("test") ' This alert never pops up
End Sub
このAddIn.vb:
Private Sub inspectors_NewInspector(ByVal Inspector As Microsoft.Office.Interop.Outlook.Inspector) Handles inspectors.NewInspector
If TypeName(Inspector.CurrentItem) = "AppointmentItem" Then
MsgBox("event")
oAppointmentItem = TryCast(Inspector.CurrentItem, Outlook.AppointmentItem)
AddHandler oAppointmentItem.Write, AddressOf Item_Save
End If
End Sub
Private Sub Item_Save(ByRef Cancel As Boolean)
'get IRibbonControl
End Sub
更新: パラメータが正しく設定されていないため、 onAction 関数が呼び出されないという問題を修正しました: Ribbon1.vb:
Public Sub Salesforce_Click(ByVal control As Office.IRibbonControl, _
ByVal isPressed As Boolean)
MsgBox("test2")
End Sub
しかし、主な問題は次のとおりです。ユーザーが保存を押したときに、toogle ボタンの状態を取得する方法は?