awillians26
New Member
- Joined
- Aug 25, 2022
- Messages
- 2
- Office Version
- 365
- 2021
- Platform
- Windows
Hi All,
I created a very basic form on VBA. However when I open the file for the first time it works perfectly, but If I opened again it doesn't open the form. What Am I missing here?
View attachment 84356
This is my code - If there's a way to clean up to make better please advise
This is the code I'm using for the WorkBook
I created a very basic form on VBA. However when I open the file for the first time it works perfectly, but If I opened again it doesn't open the form. What Am I missing here?
View attachment 84356
This is my code - If there's a way to clean up to make better please advise
VBA Code:
Private Sub CommandButton1_Click()
End Sub
Private Sub CancelButton_Click()
On Error GoTo ErrorHandler
Unload Me
Exit Sub
ErrorHandler:
MsgBox "An error occurred: " & Err.Description
End Sub
Private Sub Label1_Click()
End Sub
Private Sub Label3_Click()
End Sub
Private Sub Label4_Click()
End Sub
Private Sub Label5_Click()
End Sub
Private Sub Image1_BeforeDragOver(ByVal Cancel As MSForms.ReturnBoolean, ByVal Data As MSForms.DataObject, ByVal X As Single, ByVal Y As Single, ByVal DragState As MSForms.fmDragState, ByVal Effect As MSForms.ReturnEffect, ByVal Shift As Integer)
End Sub
Private Sub UserForm_Initialize()
dHeight = Me.Height
End Sub
Private Sub Submit_Click()
Dim LR As Long
LR = Cells(Rows.Count, 1).End(xlUp).Row + 1
Cells(LR, 3).Value = PartNumber.Value
Cells(LR, 4).Value = Vendor.Value
Cells(LR, 5).Value = Quantity.Value
Cells(LR, 6).Value = EmpName.Value
Cells(LR, 7).Value = Comments.Value
EmpName.Value = ""
Vendor.Value = ""
PartNumber = ""
Quantity.Value = ""
Comments.Value = ""
End Sub
This is the code I'm using for the WorkBook
VBA Code:
Private Sub Workbook_Open()
Application.Visible = False
Purchasing.Show
End Sub
Last edited by a moderator: