Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 109
Default Delete references

I have the following problem:

Work has Excel '97, users have been taking work home and opening the file on
a newer version of Excel. When they bring the file back to work the
refereneces box displays the following:

MISSING: Microsoft Outlook 9.0 Object Library
MISSING: Microsoft Visual Basic for Applications Extensibility 5.3

I need to be able to add another menu item to my custom menu which will
allow the user to 'untick' these references and add the relevant '97 ones
(Microsoft Outlook 98 Object Model and Microsoft Visual Basic for
Applications Extensibility).

The following seems to work to add the required references, but only after
the MISSING ones have been deleted.

Sub addreference()
Application.VBE.ActiveVBProject.References.AddFrom File "C:\Program
Files\Common Files\Microsoft Shared\Vba\Vbeext1.olb"
Application.VBE.ActiveVBProject.References.AddFrom File "C:\Program
Files\Microsoft Office\Office\msoutl85.olb"
End Sub


Is it possible to delete the MISSING references using code?

The project is protected, does it need to be unprotected to do this??

Thanks in advance.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default Delete references

You might try something like this to remove broken references:

Sub a()
Dim Counter As Integer
With ThisWorkbook.VBProject.References
For Counter = 1 To .Count
If .Item(Counter).IsBroken Then
.Remove .Item(Counter)
End If
Next
End With
End Sub

--
Jim Rech
Excel MVP


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to convert all 3d references to normal references in a workboo Dima Excel Discussion (Misc queries) 6 August 8th 08 12:38 PM
How to convert all 3d references to normal references in a workboo Dima Excel Worksheet Functions 6 August 8th 08 12:38 PM
Help with converting a block of cells with Absolute and mixed references to relative references Vulcan Excel Worksheet Functions 3 December 13th 07 11:43 PM
How to rename references from range names to cell references Abbas Excel Discussion (Misc queries) 1 May 24th 06 06:18 PM
Delete without losing references? Ed[_9_] Excel Programming 2 July 9th 03 01:50 PM


All times are GMT +1. The time now is 07:19 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"