Excel insertion dans 3 fichiers

Résolu
ketchups Messages postés 24 Date d'inscription mercredi 5 septembre 2007 Statut Membre Dernière intervention 21 décembre 2007 - 5 sept. 2007 à 11:46
ketchups Messages postés 24 Date d'inscription mercredi 5 septembre 2007 Statut Membre Dernière intervention 21 décembre 2007 - 3 oct. 2007 à 10:20
Hello tout le monde<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /??>







J’espère que quelqu’un pourra m’aider, car je galère depuis un bon moment sans trouver de solution.







Quelles est mon problème me dirait vous.







Et
ben je dois reprendre un programme d’une autre personne.







Ce programme « mixe » deux fichiers dans un document excel, malheureusement excel ne peut gérer que 60 000 lignes… et donc j’ai dût modifier le code pour avoir 2 autre fichiers. Mon 2eme fichier lui affiche ce qu’il devrait mais le 3 ème n’a pas les deux fichiers qui devrait s’y trouvé







Donc ce que je demande c’est un peut d’aide pour la fin de mon insertion excel



'#Insertion dans Excel#'






               

'Dim oXL As clsExcelHost






               
Try







                    oXL = New clsExcelHost






               
Catch







                    MessageBox.Show("Excel n'est pas installé !", "SPGTRUL", MessageBoxButtons.OK, MessageBoxIcon.Error)






                   
Exit
Sub







               
End
Try







               
Dim cptxls AsInteger






               
Dim cptfile AsInteger






    
           
Dim iLenght AsInteger = iLenght1x






               
Dim namexls AsString = "_(0-4)" (1 er fichiers)






               

cptfile = cptfile1






               
For cptxls = 1 To 2






                   
Dim nbLignes AsInteger = cptfile + 1 'iLenght + cpt + 1






                    oXL.xlApp.WorkBooks.Open(LbDest.Text & "STP-C7Plan GT-" & Format(Now.Date, "d.M.yy") & namexls & ".xls")






                    oXL.xlApp.Range("A" & CStr(iLenght + 2) & ":G" & nbLignes).Select()






                   
Dim StrTemp AsString






 
                   StrTemp = Mid(cbcolor.Text, InStr(cbcolor.Text, "(") + 1)






                   
With oXL.xlApp.Selection.Interior






                        .ColorIndex = Microsoft.VisualBasic.Left(StrTemp, InStr(StrTemp, ")") - 1)






                        .Pattern = 1






                   
End
With







                    oXL.xlApp.Range("B1:B" & nbLignes).Select()






                   

oXL.xlApp.Range("B" & nbLignes).Activate()






                   

oXL.xlApp.Range("A1:G" & nbLignes).Sort(Key1:=oXL.xlApp.Range("B" & nbLignes), Order1:=1, Header _






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






                        , DataOption1:=0)






                    oXL.xlApp.Rows("1:1").Select()






                    oXL.xlApp.Selection.Insert(Shift:=-4121)






                    oXL.xlApp.cells(1, 1) = "Name"






                    oXL.xlApp.cells(1, 2) = "CCandNDC"






                    oXL.xlApp.cells(1, 3) = "Country_Name"






                    oXL.xlApp.cells(1, 4) = "Operator_Name"






                    oXL.xlApp.cells(1, 5) = "Pointer_Name"






                    oXL.xlApp.cells(1, 6) = "STP"






                    oXL.xlApp.cells(1, 7) = "CeaseDate"






                    oXL.xlApp.Columns("A:A").EntireColumn.AutoFit()






                    oXL.xlApp.Columns("B:B").EntireColumn.AutoFit()






                    oXL.xlApp.Columns("C:C").EntireColumn.AutoFit()






                    oXL.xlApp.Columns("D:D").EntireColumn.AutoFit()






                    oXL.xlApp.Columns("E:E").EntireColumn.AutoFit()






                    oXL.xlApp.Columns("F:F").EntireColumn.AutoFit()






                    oXL.xlApp.Columns("G:G").EntireColumn.AutoFit()






                    oXL.xlApp.Rows("1:1").Select()






                    oXL.xlApp.Selection.AutoFilter()






               
    oXL.xlApp.Selection.RowHeight = 24.75






                    oXL.xlApp.Range("A1:G1").Select()






                    oXL.xlApp.Range("F1").Activate()






                   
With oXL.xlApp.Selection.Interior






                        .ColorIndex = 15






           
            .Pattern = 1






                   
End
With







                    oXL.xlApp.Range("H2").Select()






                    oXL.xlApp.ActiveWindow.FreezePanes = True






                    oXL.xlApp.Rows(nbLignes + 1 & ":" & nbLignes + 1).Select()






                    oXL.xlApp.Selection.Delete(Shift:=-4162)






                    oXL.xlApp.Range("A1").Select()






                    oXL.xlApp.DisplayAlerts = False






                    oXL.xlApp.workbooks(1).Save()






                    oXL.xlApp.workbooks(1).close()






                    namexls "_(6-9)"    ‘2ème fichier, le 3ème je ne sais pas sous quelle forme le mettre, le 3ème fichier lui devrait être namexls "_(5)






                    cptfile = cptfile2






                    iLenght = iLenght2






               
Next







               








 







               
'END#Insertion dans Excel#'







 







Si jamais vous avez besoins je vous passe par mail toute la prog

2 réponses

cs_DARKSIDIOUS Messages postés 15814 Date d'inscription jeudi 8 août 2002 Statut Membre Dernière intervention 4 mars 2013 130
5 sept. 2007 à 11:52
Salut,

Si tu fais du VB.NET pourquoi tu poste dans le forum VB6 ??? (je fais l'hypothèse que c'est du vb.net, car le try-catch n'existe pas en vb6 !)

Je déplace vers le forum approprié !
______________________________________
DarK Sidious
3
ketchups Messages postés 24 Date d'inscription mercredi 5 septembre 2007 Statut Membre Dernière intervention 21 décembre 2007
3 oct. 2007 à 10:20
j'ai réussit à me débrouiller pourrait tu supprimer ce topic?
0
Rejoignez-nous