How to insert a new reference in an excel projet

Marco Dell'Oca 181 Reputation points
2024-06-02T15:13:41.3166667+00:00

Good morning,

I have a Ms Access project that creates a new Ms Excel project and inserts data into a sheet.

I need to insert a new reference in the created Excel project.

I want to insert a reference to Ms Access to be able to invoke a Ms Access form.

Is it possible to do all this from Access?

Thanks for your help

Marco Dell'Oca

Access Development
Access Development
Access: A family of Microsoft relational database management systems designed for ease of use.Development: The process of researching, productizing, and refining new or existing technologies.
883 questions
Excel Management
Excel Management
Excel: A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.Management: The act or process of organizing, handling, directing or controlling something.
1,728 questions
{count} votes

Accepted answer
  1. Ken Sheridan 2,841 Reputation points
    2024-06-03T12:42:20.11+00:00

    In Access a reference can be added to the current database by calling the AddFromFile method of the References collection.  The following, for example would add a reference to the Adobe Acrobat type library: 

    Application.References.AddFromFile("C:\Program Files\Adobe\Acrobat DC\Acrobat\acrobat.tlb")

    I'm not very familiar with the Excel object model, but I assume you could do similar in Excel from Access through automation, by first creating a reference to the Excel file in the current database and then returning a reference to it in code in order to call the above method.

     

    1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Marco Dell'Oca 181 Reputation points
    2024-06-03T16:25:17.9566667+00:00

    Thanks for the reply, I think I'll follow Viorel's advice as it's the easiest way.

    Marco Dell'Oca

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.