Results 1 to 10 of 10
  1. #1
    Paul H's Avatar
    Paul H is offline Expert
    Windows 10 Access 2016
    Join Date
    Sep 2011
    Location
    Richmond, VA
    Posts
    591

    MISSING: Excel 16.0 Object Reference Library

    Hello fellow travelers. My application has a reference to the Excel 16.0 Object Reference Library. I believe it was already referenced when I inherited it, but I may be mistaken. I'm not sure what I need it for. I do have some exports to Excel though. That's about it. This app has been distributed to 25 or so different facilities around the state. It is 100% standalone. There is not Back End. I've posted about it many times. It is in UAT right now. A few facilities have reported a problem with a command button not working. Most have not and I have not experienced that either. After remoting in I found the MISSING tag in the references. I unchecked the box and the button worked again. This app's been in use for years. This is the first time this has come up.



    Is it safe to remove that reference or will it produce a different set of errors?

    Thanks in advance,

    Paul H

  2. #2
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,115
    Hi Paul,

    Make sure you the code uses late binding (declare your variables as object as opposed to as Excel.Work....) and you should be OK to remove the reference.

    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  3. #3
    Paul H's Avatar
    Paul H is offline Expert
    Windows 10 Access 2016
    Join Date
    Sep 2011
    Location
    Richmond, VA
    Posts
    591
    I'm not sure what that means. I found some code that I don't think is being used. Could this be the culprit?
    EDIT: I see the evidence right in front of me. I don't think I need either the code or the reference if it is not being used.

    Code:
    Public Function OpenExcelFile(strFilePathName As String)    'Required: Tools > Refences: Add reference to Microsoft Excel Object Library
        '    Form_frmMain.tabDataQualityTools.Pages(4).SetFocus
    
    
        Dim appExcel As Excel.Application
        Dim myWorkbook As Excel.Workbook
     
        Set appExcel = CreateObject("Excel.Application")
        Set myWorkbook = appExcel.Workbooks.Open(strFilePathName)
        appExcel.Visible = True
        
        'Do Something or Just Leave Open
        
        Set appExcel = Nothing
        Set myWorkbook = Nothing
     
    End Function

  4. #4
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,801
    AFAIK, you need the Excel reference to do automation. If not, that will be enlightening to say the least.
    One thing that could be done is to have a table of references and check those against the references in the project. If one is missing, you could either attempt to re-establish it (which would likely fail if versions have changed) or provide a message. What you do there would depend on circumstances, but allowing an email to be sent to you might be an option - or simply asking the user to report the message. You don't have to shut down the db because of a missing ref, but it might be better to know about it before you start some process that will fail.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  5. #5
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    different pc have different excel version, so just set the ref the one they have.

  6. #6
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,115
    Late binding:
    Code:
    Public Function OpenExcelFile(strFilePathName As String)    'Vlad 11/6/2020 NOT Required: Tools > Refences: Add reference to Microsoft Excel Object Library
        '    Form_frmMain.tabDataQualityTools.Pages(4).SetFocus
    
    
    
    
        Dim appExcel As Object 'Excel.Application
        Dim myWorkbook As Object 'Excel.Workbook
     
        Set appExcel = CreateObject("Excel.Application")
        Set myWorkbook = appExcel.Workbooks.Open(strFilePathName)
        appExcel.Visible = True
        
        'Do Something or Just Leave Open
        
        Set appExcel = Nothing
        Set myWorkbook = Nothing
     
    End Function
    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  7. #7
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    if you set the reference on a PC with the oldest version, then when you give it to a pc with newer version, it will self-install the new version. no errors, no manual work needed.
    but you cant go backwards. (give new ver. to old pc)

  8. #8
    Paul H's Avatar
    Paul H is offline Expert
    Windows 10 Access 2016
    Join Date
    Sep 2011
    Location
    Richmond, VA
    Posts
    591
    Vlad et al,

    I'll take one more whack at this. If I delete these functions and any reference to them. Could I safely remove the reference to the Excel 16.0 Library?
    Wouldn't that not be the simplest way since they are no longer in use? I'm not familiar creating Excel objects in Access and I'd just as soon not use them.

  9. #9
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,801
    Sure, removing the code is enough. Commenting it out would be another way.
    Removing the reference is a 'bonus'. Hope you're right that the function(s) are no longer used!
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  10. #10
    Paul H's Avatar
    Paul H is offline Expert
    Windows 10 Access 2016
    Join Date
    Sep 2011
    Location
    Richmond, VA
    Posts
    591
    I've scoured the code. I think I've got it covered. It's going out for testing so I'll find out one way or the other.

    Thanks to all for your replies. This forum has been invaluable.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Reference to Excel Object Library
    By jcc285 in forum Programming
    Replies: 2
    Last Post: 05-11-2017, 07:11 AM
  2. Replies: 1
    Last Post: 05-04-2016, 09:32 AM
  3. Replies: 7
    Last Post: 04-22-2016, 08:19 AM
  4. Replies: 5
    Last Post: 09-09-2014, 09:36 AM
  5. Missing Object library and .dll
    By tmcrouse in forum Forms
    Replies: 1
    Last Post: 06-23-2014, 06:17 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums