Public VBInstance As VBIDE.VBE
Public Connect As Connect
Option Explicit
Private Sub CancelButton_Click()
Connect.Hide
End Sub
Private Sub OKButton_Click()
MsgBox "AddIn operation on: " & VBInstance.FullName
End Sub
Public VBInstance As VBIDE.VBE
Public Connect As Connect
Gantilah seluruh kodenya dengan kode di bawah ini:
Option Explicit
Private Sub CancelButton_Click()
Connect.Hide
End Sub
Private Sub OKButton_Click()
Dim frm As VBIDE.VBComponent
Set frm = VBInstance.ActiveVBProject.VBComponents.Add(vbext_ct_VBForm)
With frm
.Properties("Name") = "frmMain"
.Properties("Width") = 7155
.Properties("Caption") = "Main Form"
.Properties("Height") = 5000
End With
End Sub
Langkah selanjutnya adalah meng-compile kodenya sehingga terbentuk file dengan nama "MyAddIn.dll".
Langkah-langkah menjalankan:
- Buka project baru
- Klik menu Add-Ins
- Klik Sub Menu My AddIn