Erreur de compilation projet ou bibliothèque introuvable

Excel 2003 & 2007

VBA

Bonjour à tous,

J'ai, grâce à des bouts de code que j'ai glanés sur le net, produit un fichier afin d'alimenter un fichier adhérents de mon asso.

Sur ma machine avec Excel 2003, tout fonctionne parfaitement.

Hier, j'ai fourni une copie de mon fichier à un ami qui "tourne" sous Excel 2007 et dès la création d'une fiche il bute sur un problème dont j'ai pu voir qu'il était très répandu.

Pourtant, j'ai beau chercher, je ne trouve pas la solution car, même si le message d'erreur est connu, la solution semble différente selon le fichier, la machine, la macro...

Je vous colle ici la totalité de ma macro en espérant que vous pourrez m'aider.

A noter que la macro stoppe sur la commande derlign = .Range("a65536" ).End(xlUp).Row + 1 avec le message d'erreur Erreur de compilation projet ou bibliothèque introuvable

J'ajoute que je suis vraiment débutant...

Merci d'avance,

Hubert

-*-*-*-*-*-*-*-*

Private Sub CommandButtonEnregistrer_Click()

Worksheets("TABLE" ).Visible = xlSheetVisible

Worksheets("TABLE" ).Select

With Worksheets(2)

.Unprotect

Range("A65536" ).End(xlUp).Offset(1, 0).Select

Selection.Rows.EntireRow.Select

Selection.Copy

Selection.Insert Shift:=xlDown

Application.CutCopyMode = False

derlign = .Range("a65536" ).End(xlUp).Row + 1

.Cells(derlign, 1).Value = TextBoxNum_Adh

.Cells(derlign, 2).Value = TextBoxNom

.Cells(derlign, 3).Value = TextBoxPrenom

.Cells(derlign, 4).Value = TextBoxNaissance

.Cells(derlign, 5).Value = TextBoxAdresse

.Cells(derlign, 6).Value = TextBoxVille

.Cells(derlign, 7).Value = TextBoxCP

.Cells(derlign, 8).Value = TextBoxTPH

.Cells(derlign, 9).Value = TextBoxEmail

.Cells(derlign, 10).Value = TextBoxMatricule

.Cells(derlign, 11).Value = TextBoxPOLE

.Cells(derlign, 12).Value = TextBoxTITU

.Cells(derlign, 13).Value = ListBoxGrade

.Cells(derlign, 14).Value = TextBoxDate_Grade

.Cells(derlign, 15).Value = TextBoxDate_Examen

.Cells(derlign, 16).Value = ListBoxDirection

.Cells(derlign, 17).Value = TextBoxVille2

.Cells(derlign, 18).Value = TextBoxService

.Cells(derlign, 19).Value = TextBoxOPUS

.Cells(derlign, 20).Value = ListBoxInvestiture

.Cells(derlign, 21).Value = ListBoxQualité

.Cells(derlign, 22).Value = TextBoxDate_Adhesion

.Cells(derlign, 23).Value = ListBoxCotisation

.Cells(derlign, 24).Value = TextBoxCONJOINT

.Cells(derlign, 25).Value = ListBoxMode_Paiement

.Cells(derlign, 26).Value = TextBoxMontant

.Cells(derlign, 27).Value = ListBoxN

.Cells(derlign, 28).Value = ListBoxN1

.Cells(derlign, 29).Value = ListBoxN2

.Cells(derlign, 30).Value = TextBoxOBS

.Cells(derlign, 31) = (TextBoxNom + " " + TextBoxPrenom)

Range("A1" ).CurrentRegion.Select

Selection.Sort Key1:=Range("B1" ), Order1:=xlAscending, Header:=xlGuess, _

OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _

DataOption1:=xlSortNormal

End With

Sheets("TDB" ).Select

'Efface le contenu des Box de saisie

Dim objControl As Control

For Each objControl In ADRESSE.Controls

If TypeOf objControl Is MSForms.TextBox Then

objControl.Text = ""

ElseIf TypeOf objControl Is MSForms.ComboBox Then

objControl.ListIndex = -1

ElseIf TypeOf objControl Is MSForms.ListBox Then

objControl.ListIndex = -1

End If

Next objControl

Range("A65536" ).End(xlUp).Offset(1, 0).Select

Worksheets(2).Protect DrawingObjects:=True, Contents:=True, Scenarios:=True

Worksheets(2).EnableSelection = xlUnlockedCells

Worksheets("TABLE" ).Visible = xlSheetVeryHidden

End Sub

Bonjour,

Remplaces ta ligne par:

Derlign=.Range("A"&Rows.count).End(xlUp).row+1

Cdlt

Bonjour Jean-Eric,

Merci pour cette proposition.

Je vais modifier la ligne en question et la faire tester le plus rapidement possible.

Je te tiens au courant...

Hub

Merci Banzai64,

J'ai lu et appliquerai très vite !

A bientôt

Hub

Rechercher des sujets similaires à "erreur compilation projet bibliotheque introuvable"