# Visual Basic > Visual Basic 6 and Earlier >  Add a reference by code in addin

## k_zeon

does anyone know if its possible to add a reference to a project from an addin

I was thinking of creating a small addin that would show a few references that i preselect in a setting file 
rather that all the ones in the main reference file. I could then have say 6 to choose from very quickly rather that scoll the list 

i could then tick the ones i want ( ie ones i use regulary)

just a thought

----------


## techgnome

Honestly... I don't know. And wished I had thought of that back in the day... that would have been so helpful. I'd even go so far as to macro-tize it so that with a single click I could add the same references I use on all projects. Like if there's 6 or so things I use regularly... button click and those are added.

-tg

----------


## OptionBase1

Not an answer to the question directly, but you could create and save a new Project that is configured with all of the "usual stuff" as far as selected components and references, and drop a copy of the .vbp file into the folder that VB uses for Templates (for me, it is C:\Program Files\Microsoft Visual Studio\VB98\Template\Projects), and then when you create a new project you should be able to select that template.

Of course, that doesn't address wanting to do this with an already existing project.

----------


## k_zeon

i just dug out my visual basics addin book and on page 105-106 it talks about the reference collections.

i dont have time now , but i will look at seeing if its possible. if yes then i may create it.

----------


## Eduardo-

```
VBInstance.ActiveVBProject.References.AddFromFile [Path]
```

or



```
VBInstance.ActiveVBProject.References.AddFromGuid [Guid], Major, Minor
```

----------


## dz32

This addin will search the registry and build the references list and gives you a filter on results so you can quickly hone in on what your looking for then add it

https://github.com/dzzie/addins/blob...dRefs.frm#L452

----------


## k_zeon

> This addin will search the registry and build the references list and gives you a filter on results so you can quickly hone in on what your looking for then add it
> 
> https://github.com/dzzie/addins/blob...dRefs.frm#L452


tks.

----------

