User Form not Loading

StevieMP

Board Regular
Joined
Sep 28, 2021
Messages
73
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

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
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
This sounds much like a problem I've been having (see separate thread). Although I created a macro command button using the ribbon - i.e. not via VBA - I get the same alert message saying "Cannot run the macro ''**MUTUAL FUND TRACK.xlsm'!SortROIChart'. The macro may not be available in this workbook or all macros may be disabled."
Macros are not disabled on the sheet and they will run if initiated via the macro window - but not by the button.
Other spreadsheets are not affected. This one is a new build.
 
Upvote 0
Most likely the Source file must be Trusted by each User in their own Trusted Locations option. Also, once the source file changes locations their path references must change as well.
 
Upvote 0
Thank you All - I've gone through the code and made sure all the names correspond as required. Everything seems to work now, however I will keep an eye on the error if it appears again.
 
Upvote 0

Forum statistics

Threads
1,224,811
Messages
6,181,080
Members
453,021
Latest member
Justyna P

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