conversion d'un code vba 2007 à 2003

zizoufan

XLDnaute Occasionnel
Bonjour,

J'ai fait ce code à des fins d'habillage d'une cellule en vba sous 2007 :

Range("A1:E1").Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
.Merge
End With
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
'.LineStyle = xlContinuous
.ColorIndex = 0
'.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeTop)
'.LineStyle = xlContinuous
.ColorIndex = 0
'.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeBottom)
'.LineStyle = xlContinuous
.ColorIndex = 0
'.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeRight)
'.LineStyle = xlContinuous
.ColorIndex = 0
'.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.ColorIndex = 0
'.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlInsideHorizontal)
'.LineStyle = xlContinuous
.ColorIndex = 0
'.TintAndShade = 0
.Weight = xlThin
End With
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
Range("A1:E1").Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 65535
'.TintAndShade = 0
.PatternTintAndShade = 0
End With
Cells(1, 1).Font.Bold = True
Cells(2, 1) = "Chemin de l'enregistrement": Cells(2, 2) = "Nom du fichier": Cells(2, 3) = "Crée le "
Cells(2, 4) = "Modifié le ": Cells(2, 5) = "CEA"
Range("A2:E2").Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorDark1
'.TintAndShade = -4.99893185216834E-02
.PatternTintAndShade = 0
End With


une fois sur 2003, je n'ai pas pu faire marcher le code surtout pour .tintandshade, .colorindex ??

Merci de votre aide.
 

Staple1600

XLDnaute Barbatruc
Re : conversion d'un code vba 2007 à 2003

Bonsoir à tous

zizoufan:
Voici une version allégée de ton code.
Code vba:
Sub Macro1()
With Range("A1:E1")
.HorizontalAlignment = xlCenter: .VerticalAlignment = xlBottom
.Borders.LineStyle = 1: .Borders.Weight = xlThin: .Borders.ColorIndex = 0
End With
Cells(1, 1).Font.Bold = True
Cells(2, 1) = "Chemin de l'enregistrement": Cells(2, 2) = "Nom du fichier": Cells(2, 3) = "Crée le "
Cells(2, 4) = "Modifié le ": Cells(2, 5) = "CEA"
End Sub



Le résultat est-il le même?
(sauf évidemment pour par cette dernière partie que je n'ai pas traité, cf ci-dessous)
Range("A2:E2").Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorDark1
'.TintAndShade = -4.99893185216834E-02
.PatternTintAndShade = 0
End With
 

Discussions similaires

Statistiques des forums

Discussions
312 215
Messages
2 086 326
Membres
103 179
dernier inscrit
BERSEB50