View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.newusers
Melanie Melanie is offline
external usenet poster
 
Posts: 78
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!!