hello smart people,
i am in need of some help i am trying to make a user form that can change based on needs but for some reason the program isn't running when i click the button. if you can fix this code i can then implement that fix into my larger program.
General Declarations section of the workbook
Option Explicit
Private Sub Workbook_Open()
UserForm1.Show
End Sub
UserForm Initialize section
Private Sub UserForm_Initialize()
Me.Caption = "Create Folder Form"
Me.Width = 300
Me.Height = 150
Dim lblPrompt As MSForms.Label
Set lblPrompt = Me.Controls.Add("Forms.Label.1", "lblPrompt")
With lblPrompt
.Caption = "Enter the WO# below:"
.Left = 20
.Top = 20
.Width = 200
.Height = 20
End With
Dim txtInput As MSForms.TextBox
Set txtInput = Me.Controls.Add("Forms.TextBox.1", "txtInput")
With txtInput
.Left = 20
.Top = 40
.Width = 200
.Height = 20
End With
Dim btnCreateFolder As MSForms.CommandButton
Set btnCreateFolder = Me.Controls.Add("Forms.CommandButton.1", "btnCreateFolder")
With btnCreateFolder
.Caption = "Create Folder"
.Left = 20
.Top = 70
.Width = 100
.Height = 30
End With
End Sub
Private Sub btnCreateFolder_Click()
MsgBox "hello"
End Sub
i am in need of some help i am trying to make a user form that can change based on needs but for some reason the program isn't running when i click the button. if you can fix this code i can then implement that fix into my larger program.
General Declarations section of the workbook
Option Explicit
Private Sub Workbook_Open()
UserForm1.Show
End Sub
UserForm Initialize section
Private Sub UserForm_Initialize()
Me.Caption = "Create Folder Form"
Me.Width = 300
Me.Height = 150
Dim lblPrompt As MSForms.Label
Set lblPrompt = Me.Controls.Add("Forms.Label.1", "lblPrompt")
With lblPrompt
.Caption = "Enter the WO# below:"
.Left = 20
.Top = 20
.Width = 200
.Height = 20
End With
Dim txtInput As MSForms.TextBox
Set txtInput = Me.Controls.Add("Forms.TextBox.1", "txtInput")
With txtInput
.Left = 20
.Top = 40
.Width = 200
.Height = 20
End With
Dim btnCreateFolder As MSForms.CommandButton
Set btnCreateFolder = Me.Controls.Add("Forms.CommandButton.1", "btnCreateFolder")
With btnCreateFolder
.Caption = "Create Folder"
.Left = 20
.Top = 70
.Width = 100
.Height = 30
End With
End Sub
Private Sub btnCreateFolder_Click()
MsgBox "hello"
End Sub