+ Reply to Thread
Results 1 to 7 of 7

Functions Chr, UBound - Can't find project or library

  1. #1
    Registered User
    Join Date
    07-13-2017
    Location
    India
    MS-Off Ver
    2010
    Posts
    3

    Functions Chr, UBound - Can't find project or library

    I'm having this problem where I'm unable to run function Chr, UBound and few other inbuilt functions from a macro which was working fine till yesterday. Getting error 'can't find project or library'. All references are ticked. Tried restarting Excel and machine - doesn't help.

    What makes this weird is that same functions can run through another workbook, or a new workbook in same instance of Excel. Opening tools -> references in the two workbooks separately show same results. Anyway, references are set in Excel as a whole, not in each workbook separately, so I cannot find any reason for this since this morning.

    Can someone help?

  2. #2
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: Functions Chr, UBound - Can't find project or library

    references are set in Excel as a whole, not in each workbook separately
    Wrong - references are set per workbook.

    If there is nothing marked as 'MISSING' in the References dialogue then upload a copy of the workbook - data probably not needed, just the code.

  3. #3
    Registered User
    Join Date
    07-13-2017
    Location
    India
    MS-Off Ver
    2010
    Posts
    3

    Re: Functions Chr, UBound - Can't find project or library

    Quote Originally Posted by cytop View Post
    Wrong - references are set per workbook.

    If there is nothing marked as 'MISSING' in the References dialogue then upload a copy of the workbook - data probably not needed, just the code.
    Oh ok. I see same set of references in all my workbooks, so I developed a wrong belief.
    Anyway, I see exactly the same set of references in the other workbook as well. Would you know what else could be causing this issue?

    Here's the main code. Not sure if it'd help. The nested functions are one-liners saving values form excel sheet to variables.

    Sub RunBacktest()
    Application.DisplayAlerts = False
    Application.ScreenUpdating = False
    Application.Cursor = xlWait
    Application.DisplayStatusBar = True

    Dim j As Variant

    'Set up the parameters
    Set options = New BTOptions
    Call LoadParameters

    ' Dim i As Integer
    ' ReDim timeHorizons(options.TimeHorizonLength + 1)
    ' For i = 1 To UBound(timeHorizons)
    ' timeHorizons(i) = options.timeHorizon(i - 1)
    ' Next i
    Dim i As Integer
    ReDim timeHorizons(options.TimeHorizonLength)
    For i = 0 To UBound(timeHorizons)
    timeHorizons(i) = options.timeHorizon(i)
    Next i


    'Set Conn_sensitivities = ConnectDB(options.SensitivityFile)

    Dim ws As Worksheet
    Dim ilog As Integer: ilog = 3
    Set ws = ThisWorkbook.Worksheets("Log File")
    ws.Cells.Clear
    ws.Cells(1, 1) = "Sensitivity COBs not working"
    ws.Cells(2, 1) = "Id"
    ws.Cells(2, 2) = "CptyId"
    ws.Cells(2, 3) = "COBDate"

    Set Descriptions = LoadPfDescriptions(options)


    Dim names As String
    Dim types As String
    Dim marginPeriods As String
    names = Chr(34) & Descriptions(1).portfolioId & Chr(34)
    types = Chr(34) & Descriptions(1).PFType & Chr(34)
    marginPeriods = Descriptions(1).marginPeriod
    For i = 2 To Descriptions.Count()
    names = names & "," & Chr(34) & Descriptions(i).portfolioId & Chr(34)
    types = types & "," & Chr(34) & Descriptions(i).PFType & Chr(34)
    marginPeriods = marginPeriods & "," & Descriptions(i).marginPeriod
    Next i
    options.names = names
    options.types = types
    options.marginPeriodsCpty = marginPeriods



    For i = 1 To Descriptions.Count()
    Call BacktestPf(Descriptions(i), ws, ilog)
    Next i

    'Call R
    RunR

    Application.Cursor = xlDefault
    Application.StatusBar = False
    Application.ScreenUpdating = True
    Application.DisplayAlerts = True
    End Sub
    Last edited by amprut86; 07-13-2017 at 08:23 AM.

  4. #4
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: Functions Chr, UBound - Can't find project or library

    All workbooks get the same set of 4 (I think) references by default. I have no idea why you get the error which is why I asked for a copy of the workbook.

  5. #5
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: Functions Chr, UBound - Can't find project or library

    Here's the main code. Not sure if it'd help
    No, it doesn't.

    3rd time - Upload a copy of the workbook - someone else may take a look at it.

  6. #6
    Registered User
    Join Date
    07-13-2017
    Location
    India
    MS-Off Ver
    2010
    Posts
    3

    Re: Functions Chr, UBound - Can't find project or library

    Thank you for the patience, but any file upload is blocked from my workplace.

    I could get it to work by copying all code and data/ sheets to a new file, but would still like to know if someone faced the same issue some time. It's not a a good solution to the problem.

  7. #7
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Functions Chr, UBound - Can't find project or library

    Hi,

    I cannot believe this is not a reference error because I have never seen any other cause for it.

    Make sure you have the correct workbook active in the VB Editor (you might close all other workbooks to make sure), then list all the references that are selected.
    Don
    Please remember to mark your thread 'Solved' when appropriate.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Can't Find Project or Library
    By Patnaik in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 05-15-2013, 11:28 AM
  2. Can't find project or library - MS Forms 2.0 Ojbect Library
    By RTSmith in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-11-2012, 06:51 PM
  3. Cannot find project or library
    By cmar6 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 08-28-2009, 08:25 PM
  4. Can't Find Project or Library
    By Wes28 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-19-2008, 08:48 AM
  5. Cant Find Project Or Library
    By Steel Monkey in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-06-2007, 03:07 AM
  6. Can’t find Project or Library
    By tqm1 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-05-2007, 05:06 PM
  7. [SOLVED] cannot find project or library
    By glyn in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-23-2006, 12:35 PM
  8. [SOLVED] Can't find project or library
    By salut in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-22-2006, 06:15 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1