Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Error:Can't find project or library


Hi,
I recently copied code out of one VBA project and pasted it into a new
project. The code still works fine in the original project, but in the
new project I get the Compile Error:Can't find project or library.
VBA help says this is due to a missing reference and direct me to
"Display the References dialog box", but I can't locate this dialog box
anywhere. Here is my code and the editor highlights "msg =" in the
code. Any help would be greatly appreciated.

Sub DeleteBlankLastRow_CheckIfBlank()
Dim Response As Integer
Dim rngEntryBottomRow As Range

On Error GoTo ws_exit
Application.EnableEvents = False
Application.ScreenUpdating = False
ActiveSheet.Unprotect ("geekk")
Set rngEntryBottomRow = Range("Below_Entry_Bottom_Row").Offset(-1)

'if last detail row is blank, delete one detail row and If not
empty
' then msg box to explain error and exit sub.
If Application.WorksheetFunction.CountA(rngEntryBotto mRow) 5
Then
Msg = MsgBox("You are attempting to Delete a Row that contains
User Input. Delete Row Failed", vbOKOnly + vbCritical, "Can Not Delete
Row with Information")
If Response = 1 Or 2 Then Exit Sub

End If

If Application.WorksheetFunction.CountA(rngEntryBotto mRow) = 5
Then
With rngEntryBottomRow 'rngI
..EntireRow.Delete
End With
End If

ActiveSheet.Protect ("geekk"), DrawingObjects:=True,
Contents:=True, Scenarios:=True
Application.ScreenUpdating = True
ws_exit:
Application.EnableEvents = True

End Sub


--
Casey


------------------------------------------------------------------------
Casey's Profile: http://www.excelforum.com/member.php...fo&userid=4545
View this thread: http://www.excelforum.com/showthread...hreadid=395380

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,119
Default Error:Can't find project or library

Msg is not declared in a Dim satement. I assume that you have Option Explicit
at the top of this code module (as you should) and that it doe not exist in
the other module where you copied it from. Change Msg to Response which is
delcared and you should be good to go. (To be technically correct Response
should be a long as MsgBox returns a long not an integer but under normal
circumsatances it makes not practical difference.)
--
HTH...

Jim Thomlinson


"Casey" wrote:


Hi,
I recently copied code out of one VBA project and pasted it into a new
project. The code still works fine in the original project, but in the
new project I get the Compile Error:Can't find project or library.
VBA help says this is due to a missing reference and direct me to
"Display the References dialog box", but I can't locate this dialog box
anywhere. Here is my code and the editor highlights "msg =" in the
code. Any help would be greatly appreciated.

Sub DeleteBlankLastRow_CheckIfBlank()
Dim Response As Integer
Dim rngEntryBottomRow As Range

On Error GoTo ws_exit
Application.EnableEvents = False
Application.ScreenUpdating = False
ActiveSheet.Unprotect ("geekk")
Set rngEntryBottomRow = Range("Below_Entry_Bottom_Row").Offset(-1)

'if last detail row is blank, delete one detail row and If not
empty
' then msg box to explain error and exit sub.
If Application.WorksheetFunction.CountA(rngEntryBotto mRow) 5
Then
Msg = MsgBox("You are attempting to Delete a Row that contains
User Input. Delete Row Failed", vbOKOnly + vbCritical, "Can Not Delete
Row with Information")
If Response = 1 Or 2 Then Exit Sub

End If

If Application.WorksheetFunction.CountA(rngEntryBotto mRow) = 5
Then
With rngEntryBottomRow 'rngI
.EntireRow.Delete
End With
End If

ActiveSheet.Protect ("geekk"), DrawingObjects:=True,
Contents:=True, Scenarios:=True
Application.ScreenUpdating = True
ws_exit:
Application.EnableEvents = True

End Sub


--
Casey


------------------------------------------------------------------------
Casey's Profile: http://www.excelforum.com/member.php...fo&userid=4545
View this thread: http://www.excelforum.com/showthread...hreadid=395380


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Error:Can't find project or library

Also take a look at ToolsReferences in the VBE, and see if any checked
items do say Missing.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Jim Thomlinson" wrote in message
...
Msg is not declared in a Dim satement. I assume that you have Option

Explicit
at the top of this code module (as you should) and that it doe not exist

in
the other module where you copied it from. Change Msg to Response which is
delcared and you should be good to go. (To be technically correct Response
should be a long as MsgBox returns a long not an integer but under normal
circumsatances it makes not practical difference.)
--
HTH...

Jim Thomlinson


"Casey" wrote:


Hi,
I recently copied code out of one VBA project and pasted it into a new
project. The code still works fine in the original project, but in the
new project I get the Compile Error:Can't find project or library.
VBA help says this is due to a missing reference and direct me to
"Display the References dialog box", but I can't locate this dialog box
anywhere. Here is my code and the editor highlights "msg =" in the
code. Any help would be greatly appreciated.

Sub DeleteBlankLastRow_CheckIfBlank()
Dim Response As Integer
Dim rngEntryBottomRow As Range

On Error GoTo ws_exit
Application.EnableEvents = False
Application.ScreenUpdating = False
ActiveSheet.Unprotect ("geekk")
Set rngEntryBottomRow = Range("Below_Entry_Bottom_Row").Offset(-1)

'if last detail row is blank, delete one detail row and If not
empty
' then msg box to explain error and exit sub.
If Application.WorksheetFunction.CountA(rngEntryBotto mRow) 5
Then
Msg = MsgBox("You are attempting to Delete a Row that contains
User Input. Delete Row Failed", vbOKOnly + vbCritical, "Can Not Delete
Row with Information")
If Response = 1 Or 2 Then Exit Sub

End If

If Application.WorksheetFunction.CountA(rngEntryBotto mRow) = 5
Then
With rngEntryBottomRow 'rngI
.EntireRow.Delete
End With
End If

ActiveSheet.Protect ("geekk"), DrawingObjects:=True,
Contents:=True, Scenarios:=True
Application.ScreenUpdating = True
ws_exit:
Application.EnableEvents = True

End Sub


--
Casey


------------------------------------------------------------------------
Casey's Profile:

http://www.excelforum.com/member.php...fo&userid=4545
View this thread:

http://www.excelforum.com/showthread...hreadid=395380




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Error:Can't find project or library


Jim,
Your clarivoyance (Option Explicit thing) and your code were both righ
on. Thank you. Follow up if I may. What would be the correct Declaratio
for Msg?

Bob,
Thank you for your input as well. I did go to ToolsReferences and lo
and behold, a checked reference to TMPLTNUM.XLA is preceeded b
MISSING:.
What should I do here?

Thank both of you for your time

--
Case

-----------------------------------------------------------------------
Casey's Profile: http://www.excelforum.com/member.php...nfo&userid=454
View this thread: http://www.excelforum.com/showthread.php?threadid=39538

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,119
Default Error:Can't find project or library

I hate to break it to you but the value is never used... Generally it is poor
code... in this instance this would be the most appropriate code...

Then
MsgBox "You are attempting to Delete a Row that contains User Input. " & _
"Delete Row Failed", vbOKOnly + vbCritical, "Can Not Delete " & _
"Row with Information"
Exit Sub

The statement
If Response = 1 Or 2 Then Exit Sub
is evalueated
If (Response = 1) Or (2) Then Exit Sub
Where 2 is not 0 and therefore true...

Here is some code to look at though in case you need to respond to a massage
box

if msgbox("Ok?", vbYesNo) = vbyes then
msgbox "You Pushed Yes"
else
Msgbox "You Pushed No"
end if


--
HTH...

Jim Thomlinson


"Casey" wrote:


Jim,
Your clarivoyance (Option Explicit thing) and your code were both right
on. Thank you. Follow up if I may. What would be the correct Declaration
for Msg?

Bob,
Thank you for your input as well. I did go to ToolsReferences and low
and behold, a checked reference to TMPLTNUM.XLA is preceeded by
MISSING:.
What should I do here?

Thank both of you for your time.


--
Casey


------------------------------------------------------------------------
Casey's Profile: http://www.excelforum.com/member.php...fo&userid=4545
View this thread: http://www.excelforum.com/showthread...hreadid=395380




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,119
Default Error:Can't find project or library

TmpltNum.xla is the template addin. In Excel choose Tools - Addins -
Template Utilities. This will install the addin and clear up the missing
reference...
--
HTH...

Jim Thomlinson


"Casey" wrote:


Jim,
Your clarivoyance (Option Explicit thing) and your code were both right
on. Thank you. Follow up if I may. What would be the correct Declaration
for Msg?

Bob,
Thank you for your input as well. I did go to ToolsReferences and low
and behold, a checked reference to TMPLTNUM.XLA is preceeded by
MISSING:.
What should I do here?

Thank both of you for your time.


--
Casey


------------------------------------------------------------------------
Casey's Profile: http://www.excelforum.com/member.php...fo&userid=4545
View this thread: http://www.excelforum.com/showthread...hreadid=395380


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Error:Can't find project or library

Casey,

Uncheck and see if anything goes wrong. My money says it won't.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Casey" wrote in
message ...

Jim,
Your clarivoyance (Option Explicit thing) and your code were both right
on. Thank you. Follow up if I may. What would be the correct Declaration
for Msg?

Bob,
Thank you for your input as well. I did go to ToolsReferences and low
and behold, a checked reference to TMPLTNUM.XLA is preceeded by
MISSING:.
What should I do here?

Thank both of you for your time.


--
Casey


------------------------------------------------------------------------
Casey's Profile:

http://www.excelforum.com/member.php...fo&userid=4545
View this thread: http://www.excelforum.com/showthread...hreadid=395380



  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Error:Can't find project or library


Jim,
Thank you, I have no pride whatsoever in my programming skills, I'm
still learning from guys like you. Most of what I do is cobbled
together bits and pieces of code gleened from everywhere and I record
Macros and clean'em up. Guys like you and Bob are my online mentors.
And I turn around and go to the New Users group and try and help them
out.
While I was typing this I just a notification of your reply to my
second question. Thank you very much. Have a great weekend.

PS Did'nt have an opportunity to use your idea or Bob's on the
reference problem. Had a need to restart windows and when I got back
the reference along with it's MISSING: tag were gone.


--
Casey


------------------------------------------------------------------------
Casey's Profile: http://www.excelforum.com/member.php...fo&userid=4545
View this thread: http://www.excelforum.com/showthread...hreadid=395380

  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Error:Can't find project or library


Bob,
Got your reply on the reference problem. Between the time I asked th
question originally and now; I loaded some new software and had t
restart. When I returned to Excel and the editor the reference showin
the MISSING: tag was gone through no action on my part. Least that
know about.

Thanks again for all your help, I think this is about the 5th or 6t
time you've saved my bacon

--
Case

-----------------------------------------------------------------------
Casey's Profile: http://www.excelforum.com/member.php...nfo&userid=454
View this thread: http://www.excelforum.com/showthread.php?threadid=39538

  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Error:Can't find project or library

Casey,

Just for your satisfaction, check that workbook project now and see if the
reference to TmpltNum.xla is checked or not. I would venture it is not, and
from this you can deduce that the workbook was probably started on a machine
with the addin installed and somehow a reference was made, but when
transferred to yours, no add-in, reference throws MISSING.

It is usually safe just to uncheck them. Many times they manifest themselves
in odd ways, highlighting the Right or Left function, and saying that it
cannot find the project or library.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Casey" wrote in
message ...

Bob,
Got your reply on the reference problem. Between the time I asked the
question originally and now; I loaded some new software and had to
restart. When I returned to Excel and the editor the reference showing
the MISSING: tag was gone through no action on my part. Least that I
know about.

Thanks again for all your help, I think this is about the 5th or 6th
time you've saved my bacon.


--
Casey


------------------------------------------------------------------------
Casey's Profile:

http://www.excelforum.com/member.php...fo&userid=4545
View this thread: http://www.excelforum.com/showthread...hreadid=395380



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
Compile error: Can't find project or library Melanie New Users to Excel 14 August 21st 09 02:54 AM
Can't Find Project or Library Error Vick Excel Discussion (Misc queries) 1 May 17th 08 12:25 PM
can't find project or library - error Chris T-M New Users to Excel 4 January 18th 07 10:23 PM
Comple Error Cannot Find Project or Library ExcelMonkey[_190_] Excel Programming 13 March 22nd 05 06:24 PM
Compile error: Can't find project or library Daniel[_17_] Excel Programming 3 December 8th 04 01:05 PM


All times are GMT +1. The time now is 07:27 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"