PDA

View Full Version : VBA to auto-remove missing Refernces



richardSmith
02-06-2013, 09:55 AM
I am distributing a workbook as a .xla but some users who are using it do not have all of the same references installed. How can I just pragmatically use VBA to 'untick' the reference if it is not installed on the machine the user is opening it on?

K2Guy
02-25-2013, 01:11 PM
Try this:


Sub Breaklinks()
Dim Links As Variant
Links = ActiveWorkbook.LinkSources(Type:=xlLinkTypeExcelLinks)
For i = 1 To UBound(Links)
ActiveWorkbook.BreakLink _
Name:=Links(i), _
Type:=xlLinkTypeExcelLinks
Next i
End Sub

GTO
02-26-2013, 04:10 AM
I am distributing a workbook as a .xla but some users who are using it do not have all of the same references installed. How can I just pragmatically use VBA to 'untick' the reference if it is not installed on the machine the user is opening it on?

If by "references", you mean references to libraries, my first curiosities would be to what is missing and why?

For instance, if in the Excel program, you had early-bound a later version of Word than the user has installed, then the program cannot "adjust" for a version it knows not. If for instance, your program refers to a control not installed on the users machine, then likewise, stuff will fall over. I hope I am making sense.

If you are indeed referring to library references, can you show the code, or better, a short example workbook?

Mark