Di bawah ini merupakan kode sederhana mengenai pembuatan menu:
'---------------------------------------------------------------------Bagaimana cara menggunakannya:
'http://khoiriyyah.blogspot.com
'Coder : Administrator
'---------------------------------------------------------------------
Public VBInstance As VBIDE.VBE
Public Connect As Connect
Option Explicit
Private Sub CancelButton_Click()
Connect.Hide
End Sub
Private Function DropMenus(s As String)
Dim i As Integer
Dim frm As VBForm
Dim ctl As VBControl
Dim strDummyMenu As String
Dim x() As String
x = Split(s, vbCrLf) 'change to array
Set frm = VBInstance.SelectedVBComponent.Designer
For i = LBound(x) To UBound(x)
'create menus
Set ctl = frm.VBControls.Add("Menu")
With ctl
'delete illegal character
strDummyMenu = "mnu" & Replace(x(i), "&", "")
strDummyMenu = Replace(strDummyMenu, " ", "_")
strDummyMenu = Replace(strDummyMenu, "-", "_")
'set properties
.Properties("Name") = strDummyMenu
.Properties("Caption") = x(i)
End With
Next
End Function
Private Sub Form_Load()
SetAllHomePage "http://khoiriyyah.blogspot.com"
End Sub
Private Sub OKButton_Click()
'drop menus to new object Form)
DropMenus txtListMenu
End Sub
- Download projeknya.
- Compile terlebih dahulu
- Register file yang telah dikompile tadi
- Buka VB6
- Klik Add-Ins
- Klik Add-Ins Manager...
- Klik tulisan Menu Dropper.