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

Hi ! everybody

I try to find a way to repear effects of missing library when a workbook
travel from an environnement to another one.

Of course, I don't want to do it manualy, but automatically.

I've found some procedures but they don't seems to work finely :

for instance : why do that one don't work ?
Don't matter with french strings...

The .Name and .FullPath Properties can't be read if the library is missing !
The library can't be removed if missing !

How can we remove a missing library ?

Thank's a lot for answers ! and sorry for language errors

'=======================
Sub AddMissingRefs()
'examine les références d'un projet, repère celles qui
'sont déclarées manquantes et essaye de les réinstaller

Dim LesRefs As Object, i&, Msg$, Cpt&, Rep&, Mnq&, Chemin$, Nom$

Set LesRefs = ThisWorkbook.VBProject.References
For i = 1 To LesRefs.Count
With LesRefs(i)
If .IsBroken Then
Mnq = Mnq + 1: Chemin = .FullPath: Nom = .Name
LesRefs.Remove LesRefs.Item(.Name)
If Dir(Chemin) = "" Then
Msg = "La librairie " & Nom & " est manquante et le fichier" &
vbLf
Msg = Msg & "'" & Chemin & "'" & vbLf
Msg = Msg & "ne peut être trouvé pour l'installer."
MsgBox Msg, vbCritical
Cpt = Cpt + 1
Else
LesRefs.AddFromFile Chemin
Rep = Rep + 1
End If
End If
End With
Next i

If Mnq 0 Then
If Cpt 0 Then Msg = Cpt & " référence(s) toujours manquante(s)"
If Rep 0 Then Msg = Msg & Rep & "référence(s) réinstallée(s)"
End If

End Sub

'================================



--

Bien cordialement,

Joël GARBE
www.joelgarbe.fr


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default excel missing library

You can't remove a library if you need it.

If you need it, you should make provision for having it.

If you don't need it, you shouldn't have a reference to it.

this should be resolved prior to distributing the application.

If your problem is with different versions of Excel, then you should develop
in the lowest version of excel that will use the file.

If your problem is with an additional reference (version problems), then you
should use late binding.

http://support.microsoft.com/default.aspx?kbid=245115
INFO: Using Early Binding and Late Binding in Automation

http://support.microsoft.com/default...b;EN-US;247579
INFO: Use DISPID Binding to Automate Office Applications Whenever Possible



--
Regards,
Tom Ogilvy

"Joel" wrote in message
...
Hi ! everybody

I try to find a way to repear effects of missing library when a workbook
travel from an environnement to another one.

Of course, I don't want to do it manualy, but automatically.

I've found some procedures but they don't seems to work finely :

for instance : why do that one don't work ?
Don't matter with french strings...

The .Name and .FullPath Properties can't be read if the library is missing

!
The library can't be removed if missing !

How can we remove a missing library ?

Thank's a lot for answers ! and sorry for language errors

'=======================
Sub AddMissingRefs()
'examine les références d'un projet, repère celles qui
'sont déclarées manquantes et essaye de les réinstaller

Dim LesRefs As Object, i&, Msg$, Cpt&, Rep&, Mnq&, Chemin$, Nom$

Set LesRefs = ThisWorkbook.VBProject.References
For i = 1 To LesRefs.Count
With LesRefs(i)
If .IsBroken Then
Mnq = Mnq + 1: Chemin = .FullPath: Nom = .Name
LesRefs.Remove LesRefs.Item(.Name)
If Dir(Chemin) = "" Then
Msg = "La librairie " & Nom & " est manquante et le fichier" &
vbLf
Msg = Msg & "'" & Chemin & "'" & vbLf
Msg = Msg & "ne peut être trouvé pour l'installer."
MsgBox Msg, vbCritical
Cpt = Cpt + 1
Else
LesRefs.AddFromFile Chemin
Rep = Rep + 1
End If
End If
End With
Next i

If Mnq 0 Then
If Cpt 0 Then Msg = Cpt & " référence(s) toujours manquante(s)"
If Rep 0 Then Msg = Msg & Rep & "référence(s) réinstallée(s)"
End If

End Sub

'================================



--

Bien cordialement,

Joël GARBE
www.joelgarbe.fr




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
Missing library??? pcor New Users to Excel 0 November 26th 06 04:25 PM
missing object library eagle7 Excel Discussion (Misc queries) 2 November 6th 05 04:06 AM
Missing Library Jan Il Excel Worksheet Functions 2 March 19th 05 04:56 PM
Missing library? Ko Vijn Excel Programming 4 February 5th 04 11:23 PM
Library missing.. Warrio[_2_] Excel Programming 2 October 27th 03 06:28 PM


All times are GMT +1. The time now is 08:10 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"