A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Compile error: Can't find project or library



 
 
Thread Tools Display Modes
  #1  
Old August 17th, 2009, 08:33 PM posted to microsoft.public.excel.newusers
melanie
external usenet poster
 
Posts: 156
Default Compile error: Can't find project or library

i get this error even after pasting in tried and true code. I am trying to
paste this code in a workbook I got from someone else. I am not sure why it
doesn't work (something disabled?)

seems like it doesn't like "Visual Basic for Applications" functions.

what do i need to do to make this work?

THANKS!!

  #2  
Old August 17th, 2009, 11:37 PM posted to microsoft.public.excel.newusers
Gord Dibben
external usenet poster
 
Posts: 20,252
Default Compile error: Can't find project or library

Melanie

When in the VBE go to ToolsReferences and see if any references are marked
as missing.

You may want to post your code here for trouble-shooting.


Gord Dibben MS Excel MVP

On Mon, 17 Aug 2009 12:33:01 -0700, Melanie
wrote:

i get this error even after pasting in tried and true code. I am trying to
paste this code in a workbook I got from someone else. I am not sure why it
doesn't work (something disabled?)

seems like it doesn't like "Visual Basic for Applications" functions.

what do i need to do to make this work?

THANKS!!


  #3  
Old August 18th, 2009, 02:09 PM posted to microsoft.public.excel.newusers
melanie
external usenet poster
 
Posts: 156
Default Compile error: Can't find project or library

I think I got this from you! It works in one of my other workbooks. Just
not from a workbook I got from someone else. It gives me an error at the
"Right" function. If I delete this statement, it stops at the "environ"
function.

Private Sub Workbook_Open()
Dim sFile As String
Dim sText
Dim ff As Long

sFile = Application.DefaultFilePath
' or maybe
'sFile = ThisWorkbook.Path
If Right$(sFile, 1) "\" Then sFile = sFile & "\"

sFile = sFile & "logTest.txt"

sText = Environ("Username") & vbTab & Format(Now, "yyyy-mm-dd hh:mm:ss")
'Environ("Username") is the login name of user opening the workbook
ff = FreeFile
Open sFile For Append As #ff
Print #ff, sText
Close #ff
End Sub



"Gord Dibben" wrote:

Melanie

When in the VBE go to ToolsReferences and see if any references are marked
as missing.

You may want to post your code here for trouble-shooting.


Gord Dibben MS Excel MVP

On Mon, 17 Aug 2009 12:33:01 -0700, Melanie
wrote:

i get this error even after pasting in tried and true code. I am trying to
paste this code in a workbook I got from someone else. I am not sure why it
doesn't work (something disabled?)

seems like it doesn't like "Visual Basic for Applications" functions.

what do i need to do to make this work?

THANKS!!



  #4  
Old August 18th, 2009, 03:13 PM posted to microsoft.public.excel.newusers
Gord Dibben
external usenet poster
 
Posts: 20,252
Default Compile error: Can't find project or library

Did you check for any missing references?

I tested with this line remmed out

If Right$(sFile, 1) "\" Then sFile = sFile & "\"

Code still works properly in my setup............from any workbook opened
from any folder.

You are saying that when you delete that line you get an error at

sText = Environ("Username") & vbTab & Format(Now, "yyyy-mm-dd hh:mm:ss")


Gord

On Tue, 18 Aug 2009 06:09:16 -0700, Melanie
wrote:

I think I got this from you! It works in one of my other workbooks. Just
not from a workbook I got from someone else. It gives me an error at the
"Right" function. If I delete this statement, it stops at the "environ"
function.

Private Sub Workbook_Open()
Dim sFile As String
Dim sText
Dim ff As Long

sFile = Application.DefaultFilePath
' or maybe
'sFile = ThisWorkbook.Path
If Right$(sFile, 1) "\" Then sFile = sFile & "\"

sFile = sFile & "logTest.txt"

sText = Environ("Username") & vbTab & Format(Now, "yyyy-mm-dd hh:mm:ss")
'Environ("Username") is the login name of user opening the workbook
ff = FreeFile
Open sFile For Append As #ff
Print #ff, sText
Close #ff
End Sub



"Gord Dibben" wrote:

Melanie

When in the VBE go to ToolsReferences and see if any references are marked
as missing.

You may want to post your code here for trouble-shooting.


Gord Dibben MS Excel MVP

On Mon, 17 Aug 2009 12:33:01 -0700, Melanie
wrote:

i get this error even after pasting in tried and true code. I am trying to
paste this code in a workbook I got from someone else. I am not sure why it
doesn't work (something disabled?)

seems like it doesn't like "Visual Basic for Applications" functions.

what do i need to do to make this work?

THANKS!!




  #5  
Old August 18th, 2009, 03:43 PM posted to microsoft.public.excel.newusers
Gord Dibben
external usenet poster
 
Posts: 20,252
Default Compile error: Can't find project or library

I misspoke.

If I rem out the line

If Right$(sFile, 1) "\" Then sFile = sFile & "\"

The code does nothing.............no error, just nothing.


Gord


On Tue, 18 Aug 2009 07:13:00 -0700, Gord Dibben gorddibbATshawDOTca wrote:

Did you check for any missing references?

I tested with this line remmed out

If Right$(sFile, 1) "\" Then sFile = sFile & "\"

Code still works properly in my setup............from any workbook opened
from any folder.

You are saying that when you delete that line you get an error at

sText = Environ("Username") & vbTab & Format(Now, "yyyy-mm-dd hh:mm:ss")


Gord

On Tue, 18 Aug 2009 06:09:16 -0700, Melanie
wrote:

I think I got this from you! It works in one of my other workbooks. Just
not from a workbook I got from someone else. It gives me an error at the
"Right" function. If I delete this statement, it stops at the "environ"
function.

Private Sub Workbook_Open()
Dim sFile As String
Dim sText
Dim ff As Long

sFile = Application.DefaultFilePath
' or maybe
'sFile = ThisWorkbook.Path
If Right$(sFile, 1) "\" Then sFile = sFile & "\"

sFile = sFile & "logTest.txt"

sText = Environ("Username") & vbTab & Format(Now, "yyyy-mm-dd hh:mm:ss")
'Environ("Username") is the login name of user opening the workbook
ff = FreeFile
Open sFile For Append As #ff
Print #ff, sText
Close #ff
End Sub



"Gord Dibben" wrote:

Melanie

When in the VBE go to ToolsReferences and see if any references are marked
as missing.

You may want to post your code here for trouble-shooting.


Gord Dibben MS Excel MVP

On Mon, 17 Aug 2009 12:33:01 -0700, Melanie
wrote:

i get this error even after pasting in tried and true code. I am trying to
paste this code in a workbook I got from someone else. I am not sure why it
doesn't work (something disabled?)

seems like it doesn't like "Visual Basic for Applications" functions.

what do i need to do to make this work?

THANKS!!



  #6  
Old August 18th, 2009, 03:45 PM posted to microsoft.public.excel.newusers
melanie
external usenet poster
 
Posts: 156
Default Compile error: Wrong number of arguments or invalid property...


I checked and yes there was a missing library. I unchecked it because I
don't think it is important for my purposes.
Now I get an error at the FORMAT statement saying that it has "wrong number
of arguments or invalid property assignment"

"Gord Dibben" wrote:

Did you check for any missing references?

I tested with this line remmed out

If Right$(sFile, 1) "\" Then sFile = sFile & "\"

Code still works properly in my setup............from any workbook opened
from any folder.

You are saying that when you delete that line you get an error at

sText = Environ("Username") & vbTab & Format(Now, "yyyy-mm-dd hh:mm:ss")


Gord

On Tue, 18 Aug 2009 06:09:16 -0700, Melanie
wrote:

I think I got this from you! It works in one of my other workbooks. Just
not from a workbook I got from someone else. It gives me an error at the
"Right" function. If I delete this statement, it stops at the "environ"
function.

Private Sub Workbook_Open()
Dim sFile As String
Dim sText
Dim ff As Long

sFile = Application.DefaultFilePath
' or maybe
'sFile = ThisWorkbook.Path
If Right$(sFile, 1) "\" Then sFile = sFile & "\"

sFile = sFile & "logTest.txt"

sText = Environ("Username") & vbTab & Format(Now, "yyyy-mm-dd hh:mm:ss")
'Environ("Username") is the login name of user opening the workbook
ff = FreeFile
Open sFile For Append As #ff
Print #ff, sText
Close #ff
End Sub



"Gord Dibben" wrote:

Melanie

When in the VBE go to ToolsReferences and see if any references are marked
as missing.

You may want to post your code here for trouble-shooting.


Gord Dibben MS Excel MVP

On Mon, 17 Aug 2009 12:33:01 -0700, Melanie
wrote:

i get this error even after pasting in tried and true code. I am trying to
paste this code in a workbook I got from someone else. I am not sure why it
doesn't work (something disabled?)

seems like it doesn't like "Visual Basic for Applications" functions.

what do i need to do to make this work?

THANKS!!




  #7  
Old August 18th, 2009, 03:50 PM posted to microsoft.public.excel.newusers
melanie
external usenet poster
 
Posts: 156
Default Compile error: Can't find project or library


I checked and yes there was a missing library. I unchecked it because I
don't think it is important for my purposes.
Now I get an error at the FORMAT statement saying that it has "wrong number
of arguments or invalid property assignment"
  #8  
Old August 18th, 2009, 04:15 PM posted to microsoft.public.excel.newusers
Gord Dibben
external usenet poster
 
Posts: 20,252
Default Compile error: Can't find project or library

I assume you have copied the code directly from the posting and have no
typos.

sText = Environ("Username") & vbTab & Format(Now, "yyyy-mm-dd hh:mm:ss")

Try experimenting with either of these.................

sText = Application.UserName & vbTab & Format(Now, "yyyy-mm-dd hh:mm:ss")
sText = "hoohah" & vbTab & Format(Now, "yyyy-mm-dd hh:mm:ss")

If you wish, you could email the workbook to me.

gorddibbATshawDOTca

Change the AT and DOT


Gord

On Tue, 18 Aug 2009 07:50:01 -0700, Melanie
wrote:


I checked and yes there was a missing library. I unchecked it because I
don't think it is important for my purposes.
Now I get an error at the FORMAT statement saying that it has "wrong number
of arguments or invalid property assignment"


  #9  
Old August 18th, 2009, 06:27 PM posted to microsoft.public.excel.newusers
melanie
external usenet poster
 
Posts: 156
Default Compile error: Can't find project or library

i tried both and they still don't work with the same compile error.
i'm pretty sure it has something to do with the workbook... there are no
typos in my code.
unfortunately i can't send this workbook as it's work-confidential.
oooh well... thanks anyway.
  #10  
Old August 18th, 2009, 06:30 PM posted to microsoft.public.excel.newusers
melanie
external usenet poster
 
Posts: 156
Default Compile error: Can't find project or library

I should add that if I delete the Format command, it works (but no date)
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 02:08 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.