Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default pesty "Compile Error!"

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Get a VB "Compile error in hidden module: DistMon" at start Dave Excel Discussion (Misc queries) 1 August 10th 09 12:19 AM
How correct (or remove) "Compile error in hidden module: DistMon" wlfoote Excel Discussion (Misc queries) 1 June 6th 09 02:57 AM
"compile error in hidden module": DISTMOD -- ideas to fix it?? Clare Excel Discussion (Misc queries) 3 May 29th 08 01:44 AM
Compile Error in Excel 2004 when Inputbox contains "VBCRLF" QTP Professional Excel Discussion (Misc queries) 1 November 18th 05 11:47 PM
Getting "compile error" "method or data member not found" on reinstall Bp Excel Programming 1 April 23rd 04 04:42 PM


All times are GMT +1. The time now is 09:33 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"