Checking and removing broken references

sam slade

New Member
Joined
Sep 14, 2006
Messages
22
Hi, what am i doing wrong. I am using this function to check and remove any nasty reference that aren't on the users pc.

Function CheckReference() As Boolean

Dim vbProj As VBProject ' This refers to your VBA project.
Dim chkRef As Reference ' A reference.

' Refer to the activedocument's VBA project.
Set vbProj = ActiveDocument.VBProject

' Check through the selected references in the References dialog box.
For Each chkRef In vbProj.References

' If the reference is broken, send the name to the Immediate Window.
If chkRef.IsBroken Then
Debug.Print chkRef.Name
vbProj.References.Remove chkRef
CheckReference = True
End If

Next

End Function

The point being, our pc's are almost same build but different IT departments will load certain objects whereas ours load different. BUT when it comes to debug, the system says Compile Error: User-defined type not defined.

Can anyone help?
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Hi sam slade

Maybe you just need to add the reference to the object library that manipulates objects in vba, visual basic 6, etc.

In the vb editor:

Tools>References

Look for:

Microsoft Basic for Applications Extensibility 5.3

Enable it.

Hope this helps
PGC
 
Upvote 0
hi pgc,

adding the reference has worked for my pc, except no the system is saying that Programmic access to Visual Basic project is not trusted. :devilish:

Is this becuase i locked the project with a password?
 
Upvote 0
nope not the password,

i think i solved this by selecting trust access to VB project in the Trusted Publishers tab of the security form.

thanks pgc for your help.
 
Upvote 0
lol,

thanks pgc, i still followed your link and was freaked by 'glaswegian's signature detailing my ISP and IP address ... with a strange quote .. or is it just me? love it!!
 
Upvote 0
HA!!!

don't freak me out dude!!

uh oh, boss is coming!!!

cell A2 = SOMEFORMULA(A5:A26) + SOMEMORET(2sugars)
 
Upvote 0

Forum statistics

Threads
1,213,544
Messages
6,114,249
Members
448,556
Latest member
peterhess2002

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top