Ca marche mais maintenant j'ai une erreur :
erreur d'execution 70
accés refusé
qu'est ce que c'est cette erreur
voila mon code :
Private Declare Function FindWindowA& Lib "User32" (ByVal lpClassName$, ByVal lpWindowName$)
Private Declare Function EnableWindow& Lib "User32" (ByVal hWnd&, ByVal bEnable&)
Private Declare Function GetWindowLongA& Lib "User32" (ByVal hWnd&, ByVal nIndex&)
Private Declare Function SetWindowLongA& Lib "User32" (ByVal hWnd&, ByVal nIndex&, ByVal dwNewLong&)
Private Sub Ajouter_Click()
Dim Cel As Range
Dim Cel2 As Range
Dim Cel3 As Range
If Range("A2") = "" Then
Set Cel = Range("A2")
Set Cel2 = Range("A2").Offset(0, 1)
Set Cel3 = Range("A2").Offset(0, 2)
Else
Set Cel = Range("A1").End(xlDown).Offset(1, 0)
Set Cel2 = Range("A1").End(xlDown).Offset(1, 1)
Set Cel3 = Range("A1").End(xlDown).Offset(1, 2)
End If
Cel = TextBoxNom
Cel2 = TextBoxNum
Cel3 = ComboBoxServ
End Sub
Private Sub CommandButton1_Click()
Worksheets("A-F").Select
End Sub
Private Sub CommandButton2_Click()
Worksheets("G-M").Select
End Sub
Private Sub CommandButton3_Click()
Worksheets("N-S").Select
End Sub
Private Sub CommandButton4_Click()
Worksheets("T-Z").Select
End Sub
Private Sub UserForm_Initialize()
Dim Lrange As Range
Dim Lrange2 As Range
Dim x As Variant
Dim y As Variant
' Set the range to loop through.
Set Lrange = Range("J2:J3")
Set Lrange2 = Range("A1:C1")
' Loops through the ranges.
For Each x In Lrange
' Adds an item to the list.
ComboBoxService.AddItem x.Value
ComboBoxServ.AddItem x.Value
Next x
For Each y In Lrange2
ListBoxListeRep.AddItem y.Value
Next y
Dim hWnd As Long
hWnd = FindWindowA(vbNullString, Me.Caption)
SetWindowLongA hWnd, -16, GetWindowLongA(hWnd, -16) Or &H20000
End Sub
Private Sub UserForm_Activate()
EnableWindow FindWindowA("XLMAIN", Application.Caption), 1
End Sub