add-in ו Outlook
שלום לכולם, ביניתי קוד ב Vb שאמור לבנות כפתור בoutlook בפעם הראשונה שפותחים את הoutlook הכפתור מתפקד מעולה, אבל לאחר שאני סוגרת את הOutlook ופותחת מחדש הכפתור כבר לא עובד. (לחיצה על הכפתור לא מקפיצה את הevent שלו) אשמח לעזרה אני כבר משתגעת. הנה הקוד של ה connection Private Sub AddinInstance_OnConnection(ByVal Application As Object, _ ByVal ConnectMode As AddInDesignerObjects.ext_ConnectMode, _ ByVal AddInInst As Object, custom() As Variant) Dim CommBars As CommandBars Dim objEimsCtrl As Object Dim objExplorer As Object Dim sTag As String 'Set my object to the host application. Set objOLApp = Application sTag = "My Eims Test" '''''' Set CommBars = objOLApp.ActiveExplorer.CommandBars Set objEimsCtrl = CommBars("Standard").FindControl(, , sTag) If Not objEimsCtrl Is Nothing Then Exit Sub End If Set EimsButton = objOLApp.ActiveExplorer.CommandBars("Standard").Controls.Add(1) With EimsButton .Caption = "My Eims Test" .Style = msoButtonCaption .Tag = sTag .OnAction = "!<" & AddInInst.ProgId & ">" .Visible = True End With Set colInsp = objOLApp.Inspectors End Sub הנה הקוד של הלחיצה Private Sub EimsButton_Click(ByVal Ctrl As Office.CommandBarButton, _ CancelDefault As Boolean) Dim sAttSource As String Dim objInspector As Inspector On Error GoTo eh MsgBox "You clicked on Eims Test Button" Exit Sub eh: MsgBox Err.Description End Sub וההגדרה של המשתנים Private WithEvents objOLApp As Outlook.Application Private EimsButton As Office.CommandBarButton Private LoadFromEimsBtn As Office.CommandBarButton תודה.
שלום לכולם, ביניתי קוד ב Vb שאמור לבנות כפתור בoutlook בפעם הראשונה שפותחים את הoutlook הכפתור מתפקד מעולה, אבל לאחר שאני סוגרת את הOutlook ופותחת מחדש הכפתור כבר לא עובד. (לחיצה על הכפתור לא מקפיצה את הevent שלו) אשמח לעזרה אני כבר משתגעת. הנה הקוד של ה connection Private Sub AddinInstance_OnConnection(ByVal Application As Object, _ ByVal ConnectMode As AddInDesignerObjects.ext_ConnectMode, _ ByVal AddInInst As Object, custom() As Variant) Dim CommBars As CommandBars Dim objEimsCtrl As Object Dim objExplorer As Object Dim sTag As String 'Set my object to the host application. Set objOLApp = Application sTag = "My Eims Test" '''''' Set CommBars = objOLApp.ActiveExplorer.CommandBars Set objEimsCtrl = CommBars("Standard").FindControl(, , sTag) If Not objEimsCtrl Is Nothing Then Exit Sub End If Set EimsButton = objOLApp.ActiveExplorer.CommandBars("Standard").Controls.Add(1) With EimsButton .Caption = "My Eims Test" .Style = msoButtonCaption .Tag = sTag .OnAction = "!<" & AddInInst.ProgId & ">" .Visible = True End With Set colInsp = objOLApp.Inspectors End Sub הנה הקוד של הלחיצה Private Sub EimsButton_Click(ByVal Ctrl As Office.CommandBarButton, _ CancelDefault As Boolean) Dim sAttSource As String Dim objInspector As Inspector On Error GoTo eh MsgBox "You clicked on Eims Test Button" Exit Sub eh: MsgBox Err.Description End Sub וההגדרה של המשתנים Private WithEvents objOLApp As Outlook.Application Private EimsButton As Office.CommandBarButton Private LoadFromEimsBtn As Office.CommandBarButton תודה.