Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 76
Default Check for missing references on opening

Hello

I would like have an Excel file check for missing references as the file is
opening and remove or warn of the missing reference, not stop the show.
At the moment if any references are missing all of the remaining references
don't appear to be installed either, causing code reference errors as the
file continues to open.

Any ideas
Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 789
Default Check for missing references on opening

Hi
Have you tried searching this group using,

Check for missing references on opening

regards
Paul

On Apr 1, 10:52*am, Cresta wrote:
Hello

I would like have an Excel file check for missing references as the file is
opening and remove or warn of the missing reference, not stop the show.
At the moment if any references are missing all of the remaining references
don't appear to be installed either, causing code reference errors as the
file continues to open.

Any ideas
Thanks


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Check for missing references on opening


wrote in message
...
Hi
Have you tried searching this group using,

Check for missing references on opening

regards
Paul


This assumes his Newsreader allows searching.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Check for missing references on opening

There may be a reason for a missing reference, removing it might not solve
your problems. Sometimes if it's an anticipated versioning issue you can
remove the missing ref then re-add it. Following is a direct answer to your
question but be aware it might cause more problems than it solves.

Private Sub Workbook_Open()
Dim bAskFirst As Boolean
Dim bDel As Boolean
Dim oRefs As Object ' References
Dim oRef As Object ' Reference
Dim sDes As String

bAskFirst = True ' ask before deleting

Set oRefs = Me.VBProject.References
On Error Resume Next
For Each oRef In oRefs

sDes = oRef.Description
If Err Then
If bAskFirst Then
bDel = MsgBox( _
"Remove missing ref ?" & VBA.Constants.vbCr & _
oRef.Name, 4) = 6 ' vbYesNo = 4, vbYes = 6
Else
bDel = True
End If

If bDel Then
oRefs.Remove oRef
Debug.Print oRef.Name, "Removed"
End If
Err.Clear
End If
Next

End Sub

In XL2002 and later you'll need to check Trust access to VB projects.

If you anticipate a missing reference fully qualify all VBA libraries like
VBA.Constants in the above. Although unqualified 'Constants' doesn't
generally cause problems unqualified String and DateTime functions probably
will.

Regards,
Peter T

PS
Sandusky - Search this and most ng's in Google groups


"Cresta" wrote in message
...
Hello

I would like have an Excel file check for missing references as the file

is
opening and remove or warn of the missing reference, not stop the show.
At the moment if any references are missing all of the remaining

references
don't appear to be installed either, causing code reference errors as the
file continues to open.

Any ideas
Thanks



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
Tools...References shows "MISSING:" in front of 2 references Mike Jamesson Excel Programming 1 October 19th 05 06:33 PM
Missing References Felix[_3_] Excel Programming 1 June 7th 04 03:19 PM
References.Remove References(1) DOES NOT WORK for "MISSING:" Refs Jamie Carper[_2_] Excel Programming 0 May 27th 04 04:22 PM
MIssing References RJ Excel Programming 3 April 5th 04 04:02 AM
Bad or Missing References Bill B[_3_] Excel Programming 0 January 8th 04 01:29 PM


All times are GMT +1. The time now is 08:50 PM.

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"