Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() ![]() I need serious help, I have a small form with a series of textboxes comboboxes and optionbuttons. What it basically does is th following..., the first textbox searches number string... for som reason "Trim" does not seen to work, then "Formatting number t "00000"" does not seen to work either and finally "Response MsgBox....." stops everything. I get the following in all erro messages: Compile error: Can't Find Project or library Can someone please help me? You are welcome to rewrite my code and mak it better and tider. I'm not the best code writer... just been learnin a bit here and there in this forum. The following is the code in the form: '...finds the last ocurrence of the search string Private Sub TextBox101_Change() Dim FindString As String Dim Rng As Range FindString = TextBox101.Text first error pops up = If Trim(FindString) < "" Then Set Rng = Range("C:C").Find(What:=FindString, _ After:=Range("C1"), _ LookIn:=xlFormulas, _ LookAt:=xlWhole, _ SearchOrder:=xlByRows, _ SearchDirection:=xlPrevious, _ MatchCase:=False) If Not Rng Is Nothing Then Application.Goto Rng, True End If On Error GoTo errhandler TextBox103.Value = Selection.Offset(0, 1).Text TextBox102.Value = Selection.Offset(0, -2).Text errhandler: If Err.Number = 1004 Then Err.Clear End If End Sub 'forces ref # to accept numbers only Private Sub TextBox101_KeyPress(ByVal KeyAscii A MSForms.ReturnInteger) If KeyAscii < 48 Or KeyAscii 57 Then KeyAscii = 0 Beep Else End If End Sub 'formats ref # into 5 digit # Private Sub TextBox101_Exit(ByVal Cancel As MSForms.ReturnBoolean) 2nd error pops up =TextBox101.Value = Format(TextBox101.Value "00000") End Sub '...if driver changes, vehicle number is cleared and code waits fo next selection Private Sub ComboBox101_Change() On Error Resume Next TextBox104.Text = ComboBox101.Column(1) End Sub '...Ok button Private Sub CommandButton103_Click() On Error GoTo errhandler 'If value if found next to time string, code prohibits Offset method If Selection.Offset(0, 9).Value = "" Then 'inserts content of text/combobx in sequence based on time strin location Selection.Offset(0, 9).Value = ComboBox101.Text Selection.Offset(0, 10).Value = TextBox104.Text Selection.Offset(0, 12).Value = ComboBox103.Text If OptionButton101.Value = True Then Selection.Offset(0, 11).Value = "Completed" End If If OptionButton102.Value = True Then Selection.Offset(0, 11).Value = "Rescheduled" End If If OptionButton103.Value = True Then Selection.Offset(0, 11).Value = "Cancelled" End If MsgBox "Record Status Completed!" last error pops up = response = MsgBox("Continue with anothe Record?", _ vbYesNo) 'When record is added code clears userform If response = vbYes Then TextBox101.Text = "" TextBox102.Text = "" TextBox103.Text = "" TextBox104.Text = "" ComboBox101.Text = "" ComboBox103.Text = "" OptionButton101.Value = False OptionButton102.Value = False OptionButton103.Value = False TextBox101.SetFocus 'when "no" is selected it closes form Else Unload Me End If Else MsgBox "Status Already Determined" End If If Not Rng Is Nothing Then Application.Goto Rng, True errhandler: If Err.Number = 91 Then MsgBox "errors" End If End Sub I know you're all busy people... but please help me, I have spent days on this! - Larry - VBA Amateu -- nrage2 ----------------------------------------------------------------------- nrage21's Profile: http://www.excelforum.com/member.php...nfo&userid=480 View this thread: http://www.excelforum.com/showthread.php?threadid=26475 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
hi,
sound like a library problem open the vb editor (alt + F11) goto toolsreferences there will be a list of all the libraries available. I don't know which one you are missing, you may have to find it trial and error. but checking the right library will most probably make your code run. -----Original Message----- ![]() I need serious help, I have a small form with a series of textboxes, comboboxes and optionbuttons. What it basically does is the following..., the first textbox searches number string... for some reason "Trim" does not seen to work, then "Formatting number to "00000"" does not seen to work either and finally "Response = MsgBox....." stops everything. I get the following in all error messages: Compile error: Can't Find Project or library Can someone please help me? You are welcome to rewrite my code and make it better and tider. I'm not the best code writer... just been learning a bit here and there in this forum. The following is the code in the form: '...finds the last ocurrence of the search string Private Sub TextBox101_Change() Dim FindString As String Dim Rng As Range FindString = TextBox101.Text first error pops up = If Trim(FindString) < "" Then Set Rng = Range("C:C").Find(What:=FindString, _ After:=Range("C1"), _ LookIn:=xlFormulas, _ LookAt:=xlWhole, _ SearchOrder:=xlByRows, _ SearchDirection:=xlPrevious, _ MatchCase:=False) If Not Rng Is Nothing Then Application.Goto Rng, True End If On Error GoTo errhandler TextBox103.Value = Selection.Offset(0, 1).Text TextBox102.Value = Selection.Offset(0, -2).Text errhandler: If Err.Number = 1004 Then Err.Clear End If End Sub 'forces ref # to accept numbers only Private Sub TextBox101_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger) If KeyAscii < 48 Or KeyAscii 57 Then KeyAscii = 0 Beep Else End If End Sub 'formats ref # into 5 digit # Private Sub TextBox101_Exit(ByVal Cancel As MSForms.ReturnBoolean) 2nd error pops up =TextBox101.Value = Format (TextBox101.Value, "00000") End Sub '...if driver changes, vehicle number is cleared and code waits for next selection Private Sub ComboBox101_Change() On Error Resume Next TextBox104.Text = ComboBox101.Column(1) End Sub '...Ok button Private Sub CommandButton103_Click() On Error GoTo errhandler 'If value if found next to time string, code prohibits Offset method If Selection.Offset(0, 9).Value = "" Then 'inserts content of text/combobx in sequence based on time string location Selection.Offset(0, 9).Value = ComboBox101.Text Selection.Offset(0, 10).Value = TextBox104.Text Selection.Offset(0, 12).Value = ComboBox103.Text If OptionButton101.Value = True Then Selection.Offset(0, 11).Value = "Completed" End If If OptionButton102.Value = True Then Selection.Offset(0, 11).Value = "Rescheduled" End If If OptionButton103.Value = True Then Selection.Offset(0, 11).Value = "Cancelled" End If MsgBox "Record Status Completed!" last error pops up = response = MsgBox("Continue with another Record?", _ vbYesNo) 'When record is added code clears userform If response = vbYes Then TextBox101.Text = "" TextBox102.Text = "" TextBox103.Text = "" TextBox104.Text = "" ComboBox101.Text = "" ComboBox103.Text = "" OptionButton101.Value = False OptionButton102.Value = False OptionButton103.Value = False TextBox101.SetFocus 'when "no" is selected it closes form Else Unload Me End If Else MsgBox "Status Already Determined" End If If Not Rng Is Nothing Then Application.Goto Rng, True errhandler: If Err.Number = 91 Then MsgBox "errors" End If End Sub I know you're all busy people... but please help me, I have spent 2 days on this! - Larry - VBA Amateur -- nrage21 ---------------------------------------------------------- -------------- nrage21's Profile: http://www.excelforum.com/member.php? action=getinfo&userid=4808 View this thread: http://www.excelforum.com/showthread...hreadid=264758 . |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Go into Tools=References in the VBE with this workbook as the Active
Project (it is selected in the project explorer) and see if you have any references marked as MISSING. If so, you need to uncheck them if you don't need them or find the file they refer to is you do (use the browse button). -- Regards, Tom Ogilvy "nrage21" wrote in message ... ![]() I need serious help, I have a small form with a series of textboxes, comboboxes and optionbuttons. What it basically does is the following..., the first textbox searches number string... for some reason "Trim" does not seen to work, then "Formatting number to "00000"" does not seen to work either and finally "Response = MsgBox....." stops everything. I get the following in all error messages: Compile error: Can't Find Project or library Can someone please help me? You are welcome to rewrite my code and make it better and tider. I'm not the best code writer... just been learning a bit here and there in this forum. The following is the code in the form: '...finds the last ocurrence of the search string Private Sub TextBox101_Change() Dim FindString As String Dim Rng As Range FindString = TextBox101.Text first error pops up = If Trim(FindString) < "" Then Set Rng = Range("C:C").Find(What:=FindString, _ After:=Range("C1"), _ LookIn:=xlFormulas, _ LookAt:=xlWhole, _ SearchOrder:=xlByRows, _ SearchDirection:=xlPrevious, _ MatchCase:=False) If Not Rng Is Nothing Then Application.Goto Rng, True End If On Error GoTo errhandler TextBox103.Value = Selection.Offset(0, 1).Text TextBox102.Value = Selection.Offset(0, -2).Text errhandler: If Err.Number = 1004 Then Err.Clear End If End Sub 'forces ref # to accept numbers only Private Sub TextBox101_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger) If KeyAscii < 48 Or KeyAscii 57 Then KeyAscii = 0 Beep Else End If End Sub 'formats ref # into 5 digit # Private Sub TextBox101_Exit(ByVal Cancel As MSForms.ReturnBoolean) 2nd error pops up =TextBox101.Value = Format(TextBox101.Value, "00000") End Sub '...if driver changes, vehicle number is cleared and code waits for next selection Private Sub ComboBox101_Change() On Error Resume Next TextBox104.Text = ComboBox101.Column(1) End Sub '...Ok button Private Sub CommandButton103_Click() On Error GoTo errhandler 'If value if found next to time string, code prohibits Offset method If Selection.Offset(0, 9).Value = "" Then 'inserts content of text/combobx in sequence based on time string location Selection.Offset(0, 9).Value = ComboBox101.Text Selection.Offset(0, 10).Value = TextBox104.Text Selection.Offset(0, 12).Value = ComboBox103.Text If OptionButton101.Value = True Then Selection.Offset(0, 11).Value = "Completed" End If If OptionButton102.Value = True Then Selection.Offset(0, 11).Value = "Rescheduled" End If If OptionButton103.Value = True Then Selection.Offset(0, 11).Value = "Cancelled" End If MsgBox "Record Status Completed!" last error pops up = response = MsgBox("Continue with another Record?", _ vbYesNo) 'When record is added code clears userform If response = vbYes Then TextBox101.Text = "" TextBox102.Text = "" TextBox103.Text = "" TextBox104.Text = "" ComboBox101.Text = "" ComboBox103.Text = "" OptionButton101.Value = False OptionButton102.Value = False OptionButton103.Value = False TextBox101.SetFocus 'when "no" is selected it closes form Else Unload Me End If Else MsgBox "Status Already Determined" End If If Not Rng Is Nothing Then Application.Goto Rng, True errhandler: If Err.Number = 91 Then MsgBox "errors" End If End Sub I know you're all busy people... but please help me, I have spent 2 days on this! - Larry - VBA Amateur -- nrage21 ------------------------------------------------------------------------ nrage21's Profile: http://www.excelforum.com/member.php...fo&userid=4808 View this thread: http://www.excelforum.com/showthread...hreadid=264758 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
This probably means a missing link in the VBA references.
Take a look at http://support.microsoft.com/default.aspx?kbid=166273 "Can't Find Project or Library" When You Run a Macro -- HTH RP "nrage21" wrote in message ... ![]() I need serious help, I have a small form with a series of textboxes, comboboxes and optionbuttons. What it basically does is the following..., the first textbox searches number string... for some reason "Trim" does not seen to work, then "Formatting number to "00000"" does not seen to work either and finally "Response = MsgBox....." stops everything. I get the following in all error messages: Compile error: Can't Find Project or library Can someone please help me? You are welcome to rewrite my code and make it better and tider. I'm not the best code writer... just been learning a bit here and there in this forum. The following is the code in the form: '...finds the last ocurrence of the search string Private Sub TextBox101_Change() Dim FindString As String Dim Rng As Range FindString = TextBox101.Text first error pops up = If Trim(FindString) < "" Then Set Rng = Range("C:C").Find(What:=FindString, _ After:=Range("C1"), _ LookIn:=xlFormulas, _ LookAt:=xlWhole, _ SearchOrder:=xlByRows, _ SearchDirection:=xlPrevious, _ MatchCase:=False) If Not Rng Is Nothing Then Application.Goto Rng, True End If On Error GoTo errhandler TextBox103.Value = Selection.Offset(0, 1).Text TextBox102.Value = Selection.Offset(0, -2).Text errhandler: If Err.Number = 1004 Then Err.Clear End If End Sub 'forces ref # to accept numbers only Private Sub TextBox101_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger) If KeyAscii < 48 Or KeyAscii 57 Then KeyAscii = 0 Beep Else End If End Sub 'formats ref # into 5 digit # Private Sub TextBox101_Exit(ByVal Cancel As MSForms.ReturnBoolean) 2nd error pops up =TextBox101.Value = Format(TextBox101.Value, "00000") End Sub '...if driver changes, vehicle number is cleared and code waits for next selection Private Sub ComboBox101_Change() On Error Resume Next TextBox104.Text = ComboBox101.Column(1) End Sub '...Ok button Private Sub CommandButton103_Click() On Error GoTo errhandler 'If value if found next to time string, code prohibits Offset method If Selection.Offset(0, 9).Value = "" Then 'inserts content of text/combobx in sequence based on time string location Selection.Offset(0, 9).Value = ComboBox101.Text Selection.Offset(0, 10).Value = TextBox104.Text Selection.Offset(0, 12).Value = ComboBox103.Text If OptionButton101.Value = True Then Selection.Offset(0, 11).Value = "Completed" End If If OptionButton102.Value = True Then Selection.Offset(0, 11).Value = "Rescheduled" End If If OptionButton103.Value = True Then Selection.Offset(0, 11).Value = "Cancelled" End If MsgBox "Record Status Completed!" last error pops up = response = MsgBox("Continue with another Record?", _ vbYesNo) 'When record is added code clears userform If response = vbYes Then TextBox101.Text = "" TextBox102.Text = "" TextBox103.Text = "" TextBox104.Text = "" ComboBox101.Text = "" ComboBox103.Text = "" OptionButton101.Value = False OptionButton102.Value = False OptionButton103.Value = False TextBox101.SetFocus 'when "no" is selected it closes form Else Unload Me End If Else MsgBox "Status Already Determined" End If If Not Rng Is Nothing Then Application.Goto Rng, True errhandler: If Err.Number = 91 Then MsgBox "errors" End If End Sub I know you're all busy people... but please help me, I have spent 2 days on this! - Larry - VBA Amateur -- nrage21 ------------------------------------------------------------------------ nrage21's Profile: http://www.excelforum.com/member.php...fo&userid=4808 View this thread: http://www.excelforum.com/showthread...hreadid=264758 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Get a VB "Compile error in hidden module: DistMon" at start | Excel Discussion (Misc queries) | |||
How correct (or remove) "Compile error in hidden module: DistMon" | Excel Discussion (Misc queries) | |||
"compile error in hidden module": DISTMOD -- ideas to fix it?? | Excel Discussion (Misc queries) | |||
Compile Error in Excel 2004 when Inputbox contains "VBCRLF" | Excel Discussion (Misc queries) | |||
Getting "compile error" "method or data member not found" on reinstall | Excel Programming |