I'm using this code straight from the box. Only thing is this is a MDI child.
VB Code:
Option Explicit Dim WithEvents cmdButton As CommandButton Private Sub cmdButton_Click() MsgBox "hi" End Sub Private Sub Form_Load() Set cmdButton = Me.Controls.Add("VB.CommandButton", "newCommandButton") With cmbButton .Left = 1000 .Top = 1000 .Width = 2000 .Height = 500 .Caption = "Hello" .Visible = True End With End Sub Private Sub Form_Unload(Cancel As Integer) Set cmdButton = Nothing End Sub
It is highlighting the Form Load Procedure. I see nothing wrong with this code. I've tried tinkering with it only to make it worse.. Any Help appreciated. I'm looking for a dynamic way to create toolbar items.


Reply With Quote

Mark Thread Resolved