workbook.open

C

celtic

Guest
Rebonjour a tous...
voilu le pb: il me dit kil y a un problème d'object avec
worbooks.Open (chemin)

??????



Sub OUVRIRFICHIER1()
Dim chemin As String
Dim REF As String
Dim total_heure As Integer
Dim heure As Integer
Dim trouve As Range
Dim P(7) As String
Dim i As Integer
Dim t As Integer

P(1) = Range("B2").Value
P(2) = Range("D2").Value
P(3) = Range("F2").Value
P(4) = Range("H2").Value
P(5) = Range("J2").Value
P(6) = Range("L2").Value
P(7) = Range("N2").Value

For i = 1 To 7

chemin = "C:\Transfer\essai-bilan\" & P(i) & ".xls"
worbooks.Open (chemin)
For t = 1 To 3
With ActiveWorkbook.Sheets(t).Range("B10:H20")
REF = UserForm1.Label9.Caption
Set trouve = .Find(REF)
If Not trouve Is Nothing Then
trouve.Offset(0, 6).Value = heure
total_heure = total_heure + heure

End If
End With
Next t

Next i

End Sub
 
P

Pascal76

Guest
Bonjour

essaies comme ceci

Sub OUVRIRFICHIER1()
Dim chemin As String
Dim REF As String
Dim total_heure As Integer
Dim heure As Integer
Dim trouve As Range
Dim P(7) As String
Dim i As Integer
Dim t As Integer

For i = 2 To 14 step 2

fichier=cells(2, i).value

chemin = "C:\Transfer\essai-bilan\" & fichier & ".xls"
worbooks.Open (chemin)
For t = 1 To 3
With ActiveWorkbook.Sheets(t).Range("B10:H20")
REF = UserForm1.Label9.Caption
Set trouve = .Find(REF)
If Not trouve Is Nothing Then
trouve.Offset(0, 6).Value = heure
total_heure = total_heure + heure

End If
End With
Next t

Next i

Pascal
 
M

myDearFriend!

Guest
Bonsoir Celtic, Pascal76.


Heu.... je n'ai pas analysé tout ton code Celtic, mais s'il y a un problème avec "worbooks.Open (chemin)", ne s'agirait-il pas de "Workbooks.Open (chemin)" plutôt ?


Cordialement,
Didier_mDF

myDearFriend-3.gif
 

Discussions similaires

Réponses
6
Affichages
335

Statistiques des forums

Discussions
313 095
Messages
2 095 216
Membres
106 223
dernier inscrit
gel