Results 1 to 6 of 6
  1. #1
    TamworthBob is offline Novice
    Windows 10 Access 2010 64bit
    Join Date
    May 2020
    Posts
    7

    Missing Library??

    Hi
    I am using Access2013
    I have code that appears in various on line pages trying to transfer data to an Excel spreadsheet...this works, but the code to open the spreadsheet does not!
    Here is the code:



    Private Sub cmdToExcel_Click()

    'Transfer data to the spreadsheet
    DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12Xml, "qryCRMOverviewSectionsRF", "C:\WirelessComponents\Spreadsheets\Transfer.xlsx" , True

    'Open the Spreadsheet
    Dim xlTmp As Excel.Application
    Set xlTmp = New Excel.Application
    xlTmp.Workbooks.Open "C:\WirelessComponents\Spreadsheets\Transfer.x lsx"
    xlTmp.Visible = True

    End Sub

    I seem to be missing a Microsoft addin but cannot see how to obtain and load it.

    Help appreciated.. still learning
    Thanks Bob

  2. #2
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,939
    Add the excel library in Tools/References
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  3. #3
    moke123's Avatar
    moke123 is offline Me.Dirty=True
    Windows 11 Office 365
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,654
    As Gasman correctly points out, your error is due to a missing reference. Make a good mental note of it, as it's one you'll encounter from time to time.
    This is especially true if trying out various code copied and pasted. The code you're using is early bound which requires a reference.

    Mike Wolfe has a good article to explain what that is https://nolongerset.com/early-binding-vs-late-binding/
    If this helped, please click the star * at the bottom left and add to my reputation- Thanks

  4. #4
    TamworthBob is offline Novice
    Windows 10 Access 2010 64bit
    Join Date
    May 2020
    Posts
    7
    Thanks Welshgasman
    Problem is in my year of Access there is no "Tools/References" see below
    ???????
    Thanks again
    Bob

  5. #5
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Office 365
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,977
    Its part of the VB Editor menu in all versions of Access from A95 onwards including 2010
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  6. #6
    moke123's Avatar
    moke123 is offline Me.Dirty=True
    Windows 11 Office 365
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,654
    It's in the VBE.

    Click image for larger version. 

Name:	tools.jpg 
Views:	11 
Size:	34.8 KB 
ID:	50413
    If this helped, please click the star * at the bottom left and add to my reputation- Thanks

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

Similar Threads

  1. MISSING: Excel 16.0 Object Reference Library
    By Paul H in forum Programming
    Replies: 9
    Last Post: 11-06-2020, 02:26 PM
  2. MS DAO library
    By Sheba in forum Access
    Replies: 21
    Last Post: 08-20-2014, 12:52 PM
  3. Missing Object library and .dll
    By tmcrouse in forum Forms
    Replies: 1
    Last Post: 06-23-2014, 06:17 PM
  4. ADo Library
    By Mina Garas in forum Programming
    Replies: 6
    Last Post: 11-01-2012, 02:10 AM
  5. Replies: 5
    Last Post: 07-15-2011, 12:11 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