ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Can't remove problem reference (https://www.excelbanter.com/excel-programming/400400-cant-remove-problem-reference.html)

Ian[_4_]

Can't remove problem reference
 
I'm trying to remove a reference which is marked as Missing on any machine
except my laptop (where the workbook was created).

Using the code below, I can identify all the correct references, but not the
problem one, so I can't remove it.

Set VBProj = Workbooks("II Checklist.xlt").VBProject
On Error Resume Next
For Each chkRef In VBProj.References
Debug.Print chkRef.Name
If chkRef.Name = "RefEdit" Then
VBProj.References.Remove chkRef
End If
Next

On my laptop the Debug.Print line produces the following in the Immediate
window:

Excel
stdole
Office
MSForms
RefEdit

On another machine, the output misses out the last line (RefEdit). The
problem is that, as I can't call up the name of the reference, I can't
delete it.

Any ideas, anyone?

TIA

Ian



Ian[_4_]

Can't remove problem reference
 
I've bitten the bullet on this one and emailed everyone with replacements
for the faulty workbook. I wish I could have figured out what the problem
was, though. I hate to have to give up!!

Ian

"Ian" wrote in message
...
I'm trying to remove a reference which is marked as Missing on any machine
except my laptop (where the workbook was created).

Using the code below, I can identify all the correct references, but not
the problem one, so I can't remove it.

Set VBProj = Workbooks("II Checklist.xlt").VBProject
On Error Resume Next
For Each chkRef In VBProj.References
Debug.Print chkRef.Name
If chkRef.Name = "RefEdit" Then
VBProj.References.Remove chkRef
End If
Next

On my laptop the Debug.Print line produces the following in the Immediate
window:

Excel
stdole
Office
MSForms
RefEdit

On another machine, the output misses out the last line (RefEdit). The
problem is that, as I can't call up the name of the reference, I can't
delete it.

Any ideas, anyone?

TIA

Ian





All times are GMT +1. The time now is 11:43 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com