LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 694
Default Error: can't find project or library

You're right; I mixed up with the other variable with similar name 'updfile'.

I get the same results as you did for Test1 & 2 under both XL 2003 AND XL
2000 (Win 2k machine). Both results make sense (test1: cannot use Set on a
string variable; test2 assigns an Object to an empty Variant).

Test3:
Dim s As String
s = ActiveWorkbook
Err 438: Object doesn't this property or method.
.... which makes sense too if Workbook has no default property or none that
can be cast to a string.

--
Regards,
Sébastien
<http://www.ondemandanalysis.com
<http://www.ready-reports.com

"Tim Zych" wrote:

You are assigning a Workbook object to a string variable.


But he's not. The "Dim ursfile.." line is commented out in his post. And, he
says this works in 2000.

' -----------------
' Test 1
' -----------------
' Option Explicit
Dim s As String
Set s = ActiveWorkbook

Error is "Object required", not "Can't find project or library."

' -----------------
' Test 2
' -----------------
' Option Explicit
' Dim s As String
Set s = ActiveWorkbook

Works OK.

XL 2003

--
Tim Zych
SF, CA

"sebastienm" wrote in message
...
Hi,

You are assigning a Workbook object to a string variable.
So either you assign the object to an object:
dim usrfile As Workbook
set usrfile = ActiveWorkbook
debug.print usrfile.name
or you assign the name of the book to a striung variable
dim usrfile as string
usrfile = ActiveWorkbook.Name
debug.print usrfile

--
Regards,
Sébastien
<http://www.ondemandanalysis.com
<http://www.ready-reports.com


"Andyjim" wrote:

Hi-
We are trying to put out a small investment system in Excel to many
users.
When I run the following macro with Excel 2000 it runs fine, but when I
run
it with Excel v. 2003, I get the error: Can't find project or library. I
will mark below where the error occurs. As a follow up question, will we
need to send out different macros to users depending on their version of
Excel? You guys always come through for me. Thanks in advance!

Sub PlanCa()
'Modified BevUpdate2 because it assumes
'user's filename is "UserFile.xls"
'Will also attempt to make a variable for user's file

Dim updfile As String
' Dim usrfile As String
' Dim n, p
' n = ActiveWorkbook.Name
' p = ActiveWorkbook.Path
updfile = ActiveWorkbook.Path
updfile = updfile & "\" & "devfile.xls"
' updfile = p & "\" & "devfile.xls"
' usrfile = p & "\" & n
Set usrfile = ActiveWorkbook 'HERE IS WHERE ERROR OCCURS!!!!!!!!!!
' Set updfile = updfile 'Tried to make it an object
'ERROR: REQUIRES OBJECT

'Make backup of user's file
usrfile.SaveCopyAs filename:="fxRiskMasterBackup.xls"
'Prefer "Backup" append to User's own filename,
'and save in current folder.

'Insert Filename in Filename cell
Range("Filename") = ActiveWorkbook.Name

'Copy Filename to Update file: UserFilename cell
Sheets("Lookup").Visible = True
Application.Goto Reference:="Filename"
Selection.Copy
'Workbooks.Open Filename:=updfile 'OPEN devFile
If Dir(updfile) = "" Then
MsgBox ("Devfile.xls not found. Move devfile.xls to this
folder.")
Exit Sub
End If
' On Error Resume Next
' Test to see if the file is open.

If IsFileOpen(updfile) Then
' Display a message stating the file in use.
'MsgBox "File already in use!"

Else
' Display a message stating the file is not in use.
' MsgBox "File not open!"
' Open the file in Microsoft Excel.

Workbooks.Open filename:=updfile 'OPEN devFile

End If


'Workbooks.Open Filename:=updfile 'OPEN devFile
'Copy Filename to Update file: UserFilename cell
usrfile.Activate
Sheets("Lookup").Visible = True
Application.Goto Reference:="Filename"
Selection.Copy
Windows("devFile.xls").Activate
Sheets("Lookup").Visible = True
Application.Goto Reference:="userfilename"
ActiveSheet.Paste

'Copy Current Version to Update file, Old Version cell
usrfile.Activate 'WORKS!
Application.Goto Reference:="CurrentVersion"
Application.CutCopyMode = False
Selection.Copy

'Activate devFile. Can't make this happen with variable
' updfile.Activate 'ERROR: INVALID QUALIFIER
' Windows(updfile).Activate 'ERROR: SUBSCRIPT OUT OF RANGE
Windows("devFile.xls").Activate
Application.Goto Reference:="OldVersion"
ActiveSheet.Paste

'Activate Update2 macro
' Application.Run "'devFile.xls'!Update3"
' Application.Run "!Update3"
' Application.Run "'updfile'!Update3"
' Application.Run "'ActiveWorkbook'!Update2"
Application.Run "'devfile.xls'!Update2"

End Sub




 
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
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
error can't find project or library cedtech23[_19_] Excel Programming 1 July 21st 06 06:48 PM
Error:Can't find project or library Casey[_19_] Excel Programming 9 August 13th 05 09:53 AM
Comple Error Cannot Find Project or Library ExcelMonkey[_190_] Excel Programming 13 March 22nd 05 06:24 PM


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