User Form not Loading

StevieMP

Board Regular
Joined
Sep 28, 2021
Messages
72
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Hi There,
A really stupid question - I have added a User Form to a spreadsheet which I have saved in the spreadsheet and I have saved it on Microsoft Teams so other Users can access the same spreadsheet. The spreadsheet works for me, (the form loads and I can input as required) however another colleague who can now access the same spreadsheet has pointed out the form cannot be loaded for them.

I have the following code:

VBA Code:
Sub Button1_Click()

frmED.Show

End Sub

VBA Code:
Option Explicit

Private Sub cmdAdd_Click()

Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("Sheet1")

'find first empty row in database
iRow = ws.Cells.Find(What:="*", SearchOrder:=xlRows, _
    SearchDirection:=xlPrevious, LookIn:=xlValues).Row + 1

With ws
'  .Unprotect Password:="password"
  .Cells(iRow, 1).Value = Me.txtDAName.Value
  .Cells(iRow, 2).Value = Me.txtL.Value
  .Cells(iRow, 3).Value = Me.txtNewAmend.Value
  .Cells(iRow, 4).Value = Me.txtFC.Value
  .Cells(iRow, 5).Value = Me.txtOGL.Value

End With

'clear the data
Me.txtDAName.Value = ""
Me.txtL.Value = ""
Me.txtNewAmend.Value = ""
Me.txtFC.Value = ""
Me.txtOGL.Value = ""

End Sub

Private Sub cmdCancel_Click()

Unload Me

End Sub

Private Sub cmdClose_Click()

Unload Me

End Sub

Private Sub CmdClear_Click()

Unload Me

End Sub

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)

If CloseMode = vbFormControlMenu Then
Cancel = True
MsgBox "Please use the Close Form Button!"
End If

End Sub


Private Sub UserForm_Initialize()

' Initialize frm
' (This runs everytime the form is opened)
' frm is the form name
'
    ' Reset the size
    With frmED
        ' Set the form size
        Height = 369
        Width = 392
    End With
End Sub



The error message is :
"Cannot run the macro "Tracker Log.xlsm'!Sheet1.Button1_Click' The macro may not be available in this workbook or all macros may be disabled.

I'm not sure what to look for as I'm new to form creating.
Any pointers would be appreciated.
Thank you.
 
Last edited by a moderator:

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Verify the following names are accurate :

frmED.Show
txtDAName.Value
txtL.Value
txtNewAmend.Value
txtFC.Value
txtOGL.Value

If one of the controls is misspelled in your macro it would prevent the form from opening ... even thou it is opening for you. Strange ... yes.
 
Upvote 0
Verify the following names are accurate :

frmED.Show
txtDAName.Value
txtL.Value
txtNewAmend.Value
txtFC.Value
txtOGL.Value

If one of the controls is misspelled in your macro it would prevent the form from opening ... even thou it is opening for you. Strange ... yes.
The names are accurate yes.
 
Upvote 0

Forum statistics

Threads
1,221,808
Messages
6,162,097
Members
451,742
Latest member
JuanMark10

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top