[LEFT][COLOR=#333333][FONT=Verdana]Sub AddReference()[/FONT][/COLOR]
[COLOR=#333333][FONT=Verdana]'Macro purpose: To add a reference to the project using the GUID for the[/FONT][/COLOR]
[COLOR=#333333][FONT=Verdana]'reference library[/FONT][/COLOR]
[COLOR=#333333][FONT=Verdana] Dim strGUID As String[/FONT][/COLOR]
[COLOR=#333333][FONT=Verdana] 'Update the GUID you need below.[/FONT][/COLOR]
[COLOR=#333333][FONT=Verdana] strGUID = "{2DF8D04C-5BFA-101B-BDE5-00AA0044DE52}"[/FONT][/COLOR]
[COLOR=#333333][FONT=Verdana] 'Set to continue in case of error[/FONT][/COLOR]
[COLOR=#333333][FONT=Verdana] On Error Resume Next[/FONT][/COLOR]
[COLOR=#333333][FONT=Verdana] 'Add the reference[/FONT][/COLOR]
[COLOR=#333333][FONT=Verdana] ThisWorkbook.VBProject.References.AddFromGuid _[/FONT][/COLOR]
[COLOR=#333333][FONT=Verdana] GUID:=strGUID, Major:=1, Minor:=0[/FONT][/COLOR]
[COLOR=#333333][FONT=Verdana] 'If an error was encountered, inform the user[/FONT][/COLOR]
[COLOR=#333333][FONT=Verdana] Select Case Err.Number[/FONT][/COLOR]
[COLOR=#333333][FONT=Verdana] Case Is = 32813[/FONT][/COLOR]
[COLOR=#333333][FONT=Verdana] 'Reference already in use. No action necessary[/FONT][/COLOR]
[COLOR=#333333][FONT=Verdana] Case Is = vbNullString[/FONT][/COLOR]
[COLOR=#333333][FONT=Verdana] 'Reference added without issue[/FONT][/COLOR]
[COLOR=#333333][FONT=Verdana] Case Else[/FONT][/COLOR]
[COLOR=#333333][FONT=Verdana] 'An unknown error was encountered, so alert the user[/FONT][/COLOR]
[COLOR=#333333][FONT=Verdana] MsgBox "A problem was encountered trying to" & vbNewLine _[/FONT][/COLOR]
[COLOR=#333333][FONT=Verdana] & "add or remove a reference in this file" & vbNewLine & "Please check the " _[/FONT][/COLOR]
[COLOR=#333333][FONT=Verdana] & "references in your VBA project!", vbCritical + vbOKOnly, "Error!"[/FONT][/COLOR]
[COLOR=#333333][FONT=Verdana] End Select[/FONT][/COLOR]
[COLOR=#333333][FONT=Verdana] On Error GoTo 0[/FONT][/COLOR]
[COLOR=#333333][FONT=Verdana]End Sub[/FONT][/COLOR][/LEFT]