Bonjour,
Voil=E0, je dois importer 2 fichiers texte dans un fichier=20
Excel, sous VB 6.0(et pas VBA!)
Le probl=E8me c'est que, si les donn=E9es de ces fichiers=20
doivent =EAtre dans le meme workbook, ils ne doivent pas=20
=EAtre dans la meme worksheet! de plus, je voudrais mettre=20
des bordures et un titre au d=E9but de chaque worksheet.
J'utilise donc opentext pour l'import, =E7a marche, mais=20
impossible de cr=E9er un nouveau worksheet (il m'=E9crase le=20
fichier pr=E9c=E9dent) ou de faire une quelconque mise en=20
page...
Quelqu'un aurait il une solution? merci!
Set objSheet2 = objBook.Worksheets.Add objSheet2.Cells(1, 1) = "Titre 2" objSheet2.Cells(2, 1) = "Texte ligne 1"
objSheet1.Select With objSheet1 .Range("A1:A2").Select Selection.Borders(xlDiagonalDown).LineStyle = xlNone Selection.Borders(xlDiagonalUp).LineStyle = xlNone With Selection.Borders(xlEdgeLeft) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.Borders(xlEdgeTop) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.Borders(xlEdgeBottom) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.Borders(xlEdgeRight) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With End With
Set objExcel = Nothing
End Sub
"Noisy" wrote in message news:c3f701c47a37$060b4b90$ Bonjour, Voilà, je dois importer 2 fichiers texte dans un fichier Excel, sous VB 6.0(et pas VBA!) Le problème c'est que, si les données de ces fichiers doivent être dans le meme workbook, ils ne doivent pas être dans la meme worksheet! de plus, je voudrais mettre des bordures et un titre au début de chaque worksheet. J'utilise donc opentext pour l'import, ça marche, mais impossible de créer un nouveau worksheet (il m'écrase le fichier précédent) ou de faire une quelconque mise en page... Quelqu'un aurait il une solution? merci!
Bonjour Noisy
Voici une façon de créer 2 nouvelles feuilles et de les modifier.
Sous toutes réserves.
Private Sub Command1_Click()
Dim objExcel As Excel.Application
Dim objBook As Excel.Workbook
Dim objSheet1 As Excel.Worksheet
Dim objSheet2 As Excel.Worksheet
Set objExcel = New Excel.Application
Set objBook = objExcel.Workbooks.Add
Set objSheet1 = objBook.Worksheets.Add
Set objSheet2 = objBook.Worksheets.Add
objSheet2.Cells(1, 1) = "Titre 2"
objSheet2.Cells(2, 1) = "Texte ligne 1"
objSheet1.Select
With objSheet1
.Range("A1:A2").Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
End With
Set objExcel = Nothing
End Sub
"Noisy" <noisy@noos.fr> wrote in message
news:c3f701c47a37$060b4b90$a401280a@phx.gbl...
Bonjour,
Voilà, je dois importer 2 fichiers texte dans un fichier
Excel, sous VB 6.0(et pas VBA!)
Le problème c'est que, si les données de ces fichiers
doivent être dans le meme workbook, ils ne doivent pas
être dans la meme worksheet! de plus, je voudrais mettre
des bordures et un titre au début de chaque worksheet.
J'utilise donc opentext pour l'import, ça marche, mais
impossible de créer un nouveau worksheet (il m'écrase le
fichier précédent) ou de faire une quelconque mise en
page...
Quelqu'un aurait il une solution? merci!
Set objSheet2 = objBook.Worksheets.Add objSheet2.Cells(1, 1) = "Titre 2" objSheet2.Cells(2, 1) = "Texte ligne 1"
objSheet1.Select With objSheet1 .Range("A1:A2").Select Selection.Borders(xlDiagonalDown).LineStyle = xlNone Selection.Borders(xlDiagonalUp).LineStyle = xlNone With Selection.Borders(xlEdgeLeft) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.Borders(xlEdgeTop) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.Borders(xlEdgeBottom) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.Borders(xlEdgeRight) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With End With
Set objExcel = Nothing
End Sub
"Noisy" wrote in message news:c3f701c47a37$060b4b90$ Bonjour, Voilà, je dois importer 2 fichiers texte dans un fichier Excel, sous VB 6.0(et pas VBA!) Le problème c'est que, si les données de ces fichiers doivent être dans le meme workbook, ils ne doivent pas être dans la meme worksheet! de plus, je voudrais mettre des bordures et un titre au début de chaque worksheet. J'utilise donc opentext pour l'import, ça marche, mais impossible de créer un nouveau worksheet (il m'écrase le fichier précédent) ou de faire une quelconque mise en page... Quelqu'un aurait il une solution? merci!