VBA Userform Displaying Errors For Some Users and Not Others

mike90

New Member
Joined
Jun 2, 2011
Messages
16
Hello all,

I have created a simple UserForm that basically dumps information entered into the form into a worksheet.

It has been working fine for around 2/3 months until now - a compile error message comes up when hitting the enter command button stating "Cannot Find Project Or Library", however there has been no change whatsoever to the coding and only occurs on certain machines / profiles.

I have no idea what is causing this!! Please help!?

Kindest Regards

Mike
 

Some videos you may like

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.

Hermanito

Well-known Member
Joined
Apr 4, 2007
Messages
1,238
Have these machines where the error occurs been able to use it without error before?
Has anything changed on these machines? (new Windows version? new Office version? ...)
 

mike90

New Member
Joined
Jun 2, 2011
Messages
16
yes they have been using it for the past 2/3 months without any problems - and as far as im aware nothing has been updated or changed.

I have spoken with my colleague who has informed that they have circular references in use on other worksheets and so has Iterative calculations enabled, however this does not relate to the UserForm

dont know if that helps?
 

RoryA

MrExcel MVP, Moderator
Joined
May 2, 2008
Messages
35,819
Office Version
  1. 365
  2. 2019
  3. 2016
  4. 2010
Platform
  1. Windows
  2. MacOS
Does the workbook contain references to other Office apps or non-standard controls? If so, I suspect a windows/office update has broken something, or you are not all on the same version.
 

mike90

New Member
Joined
Jun 2, 2011
Messages
16

ADVERTISEMENT

It does contain a reference to Outlook, in which it generates an email to be sent if the data contains a specified value.

All the machines run on 2007 and no updates have been installed - as far as im aware.
 

RoryA

MrExcel MVP, Moderator
Joined
May 2, 2008
Messages
35,819
Office Version
  1. 365
  2. 2019
  3. 2016
  4. 2010
Platform
  1. Windows
  2. MacOS
Which reference is shown as MISSING: on the machine(s) with the problem?
 

mike90

New Member
Joined
Jun 2, 2011
Messages
16

ADVERTISEMENT

Not too sure what reference is missing - when the debugger runs it highlights:

Public Sub CommandButton1_Click()

Full Code:

Public Sub CommandButton1_Click()
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("PartsData")
'find first empty row in database
iRow = ws.Cells(Rows.Count, 1) _
.End(xlUp).Offset(1, 0).Row
'check for a part number
If Trim(Me.txtJobNo.Value) = "" Then
Me.txtJobNo.SetFocus
MsgBox "Please enter a job number"
Exit Sub
End If

'copy the data to the database
ws.Cells(iRow, 1).Value = Format(Me.txtDate.Value, "mm-dd-yyyy")
ws.Cells(iRow, 2).Value = Me.txtJobNo.Value
ws.Cells(iRow, 3).Value = Me.txtCusRef.Value
ws.Cells(iRow, 4).Value = Me.txtTOC.Value
ws.Cells(iRow, 5).Value = Me.txtTOB.Value
ws.Cells(iRow, 6).Value = Me.txtJourney.Value
ws.Cells(iRow, 7).Value = Me.txtIncident.Value
ws.Cells(iRow, 8).Value = Me.txtResolution.Value
ws.Cells(iRow, 9).Value = Me.cboType.Value
ws.Cells(iRow, 10).Value = Me.cboBy.Value
ws.Cells(iRow, 11).Value = Me.cboTo.Value
ws.Cells(iRow, 12).Value = Me.cboCus.Value
ws.Cells(iRow, 13).Value = Me.cboSup.Value

'email notifications depending on type
Dim olapp As Outlook.Application
Dim olmail As MailItem
Set olapp = New Outlook.Application
Set olmail = olapp.CreateItem(olMailItem)
If Me.cboType = "T1" Then
With olmail
.To =
.CC =
.Subject = "T1 Case Raised"
.Body = "Job Number" + ", " + txtJobNo.Value + ", " + txtIncident.Value + ", " + txtResolution.Value + ", " + cboSup.Value + ", " + cboCus.Value
.Display
End With
Set olmail = Nothing
Set olapp = Nothing
End If

'clear the data
Me.txtDate.Value = ""
Me.txtJobNo.Value = ""
Me.txtCusRef.Value = ""
Me.txtTOC.Value = ""
Me.txtTOB.Value = ""
Me.txtJourney.Value = ""
Me.txtIncident.Value = ""
Me.txtResolution.Value = ""
Me.cboType.Value = ""
Me.cboBy.Value = ""
Me.cboTo.Value = ""
Me.cboCus.Value = ""
Me.cboSup.Value = ""
Me.txtDate.SetFocus
End Sub
 

RoryA

MrExcel MVP, Moderator
Joined
May 2, 2008
Messages
35,819
Office Version
  1. 365
  2. 2019
  3. 2016
  4. 2010
Platform
  1. Windows
  2. MacOS
You have to check Tools-References in the VBEditor on the machine with the problem.
 

RoryA

MrExcel MVP, Moderator
Joined
May 2, 2008
Messages
35,819
Office Version
  1. 365
  2. 2019
  3. 2016
  4. 2010
Platform
  1. Windows
  2. MacOS
Do you actually use that? If not, uncheck it and save the workbook.
 

Watch MrExcel Video

Forum statistics

Threads
1,118,808
Messages
5,574,434
Members
412,592
Latest member
moonsugar
Top