Beste mensen, ik ben momenteel bezig met het bouwen van een outlook Add-in middels visual studio 2008. Ik heb reeds een menu gebouwd in visual basic, alleen nu moet door middel van een keuze in het menu een userform worden weergegeven. Normaal doe je dit in visual basic door middel van [naam formulier].show
maar dit lukt me niet bij het bouwen van de add-on.
Ik hoop dat iemand mij hiermee kan helpen, dit is de code die ik tot nu toe heb:
Ik hoop dat iemand mij hiermee kan helpen.
Want ik kan het ook niet echt vinden op google.
Groetjes Kevin
maar dit lukt me niet bij het bouwen van de add-on.
Ik hoop dat iemand mij hiermee kan helpen, dit is de code die ik tot nu toe heb:
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
| Public Class ThisAddIn
Private cbMenuBar As Office.CommandBar
Private cbMenu As Office.CommandBarPopup
Private cbMenuItem1 As Office.CommandBarButton
Private cbMenuItem2 As Office.CommandBarButton
Private cbMenuItem3 As Office.CommandBarButton
Private sTag As String = "Agenda Bewerken"
Private Sub ThisAddIn_Startup(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Startup
RemoveMenubar()
AddMenuBar()
End Sub
Private Sub ThisAddIn_Shutdown(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Shutdown
End Sub
Private Sub AddMenuBar()
Try
cbMenuBar = Me.Application.ActiveExplorer().CommandBars.ActiveMenuBar
cbMenu = cbMenuBar.Controls.Add( _
Office.MsoControlType.msoControlPopup, _
Temporary:=False)
If cbMenu IsNot Nothing Then
cbMenu.Caption = "Agenda Bewerken"
cbMenu.Tag = sTag
cbMenuItem1 = cbMenu.Controls.Add( _
Office.MsoControlType.msoControlButton, _
Before:=1, Temporary:=True)
With cbMenuItem1
.Style = Office.MsoButtonStyle.msoButtonIconAndCaption
.Caption = "Diensten toevoegen"
.FaceId = 65
.Tag = "c123"
End With
cbMenuItem2 = cbMenu.Controls.Add(Office.MsoControlType.msoControlButton, Before:=2, Temporary:=True)
With cbMenuItem2
.Style = Office.MsoButtonStyle.msoButtonIconAndCaption
.Caption = "Diensten wijzigen"
.FaceId = 65
.Tag = "c124"
End With
cbMenuItem3 = cbMenu.Controls.Add(Office.MsoControlType.msoControlButton, Before:=3, Temporary:=True)
With cbMenuItem3
.Style = Office.MsoButtonStyle.msoButtonIconAndCaption
.Caption = "Diensten verwijderen"
.FaceId = 65
.Tag = "c125"
End With
AddHandler cbMenuItem1.Click, AddressOf MenuItem1_Click
AddHandler cbMenuItem2.Click, AddressOf MenuItem2_Click
AddHandler cbMenuItem3.Click, AddressOf MenuItem3_Click
cbMenu.Visible = True
End If
Catch Ex As Exception
System.Windows.Forms.MessageBox.Show(Ex.Message)
End Try
End Sub
Private Sub RemoveMenubar()
Try
' If the menu already exists, remove it.
Dim foundMenu As Office.CommandBarPopup = Me.Application.ActiveExplorer().CommandBars.ActiveMenuBar.FindControl(Office.MsoControlType.msoControlPopup, System.Type.Missing, sTag, True, True)
If foundMenu IsNot Nothing Then
foundMenu.Delete(True)
End If
Catch Ex As Exception
System.Windows.Forms.MessageBox.Show(Ex.Message)
End Try
End Sub
Public Sub MenuItem1_Click(ByVal buttonControl As Office.CommandBarButton, ByRef Cancel As Boolean)
MsgBox("U heeft op de eerste optie geklikt!")
End Sub
Public Sub MenuItem2_Click(ByVal buttonControl As Office.CommandBarButton, ByRef Cancel As Boolean)
MsgBox("U heeft op de tweede optie geklikt!")
End Sub
Public Sub MenuItem3_Click(ByVal buttonControl As Office.CommandBarButton, ByRef Cancel As Boolean)
MsgBox("U heeft op de derde optie geklikt!")
End Sub
End Class |
Ik hoop dat iemand mij hiermee kan helpen.
Want ik kan het ook niet echt vinden op google.
Groetjes Kevin