Re : Impression zone de texte impossible
voici le code,
je ne suis pas un expert en vba, il n'est surement pas parfait.
je ne peux pas envoyer le fichier complet, il comporte des éléments confidentiels.
Le fichier précedemment envoyé s'imprime parfaitement sur mon poste en excel 2010 et pas sur un autre en exel 2007. cela concerne que la zone texte "zxtx4".
Merci de votre aide.
RB
Sub zone_de_txt()
Dim L As Single, T As Single, H As Single, W As Single
Dim Pos1 As Single, Pos2 As Single, Pos3 As Single, Pos4 As Single
'Dimensions et position de la zone de texte
'H = 50 '<-- hauteur
'W = 250 '<-- largeur
'L = 0 '<-- position horizontale
'T = 0 '<-- position verticale
H = Range("A" & Pos + position).Height '* 4 '<-- hauteur
W = Range("B" & Pos + position).Left - Range("A" & Pos + position).Left '<-- largeur
L = Range("A" & Pos + position).Left '<-- position horizontale
T = Range("A" & Pos + position).Top '<-- position verticale
H1 = Range("C" & Pos + position).Height '* 4 '<-- hauteur
W1 = Range("D" & Pos + position).Left - Range("C" & Pos + position).Left '<-- largeur
L1 = Range("C" & Pos + position).Left '<-- position horizontale
T1 = Range("C" & Pos + position).Top '<-- position verticale
H2 = Range("A" & Pos + 2 + position).Height '* 4 '<-- hauteur
W2 = Range("D" & Pos + position).Left - Range("A" & Pos + 2 + position).Left '<-- largeur
L2 = Range("A" & Pos + 2 + position).Left '<-- position horizontale
T2 = Range("A" & Pos + 2 + position).Top '<-- position verticale
H4 = Range("A" & Pos + 4 + position).Height '* 4 '<-- hauteur
W4 = Range("D" & Pos + 4 + position).Left - Range("A" & Pos + 4 + position).Left '<-- largeur
L4 = Range("A" & Pos + 4 + position).Left '<-- position horizontale
T4 = Range("A" & Pos + 4 + position).Top '<-- position verticale
H5 = Range("A" & Pos + 5 + position).Height '* 4 '<-- hauteur
W5 = Range("D" & Pos + 5 + position).Left - Range("A" & Pos + 5 + position).Left '<-- largeur
L5 = Range("A" & Pos + 5 + position).Left '<-- position horizontale
T5 = Range("A" & Pos + 5 + position).Top '<-- position verticale
H6 = Range("A" & Pos + 7 + position).Height '* 4 '<-- hauteur
W6 = Range("D" & Pos + 7 + position).Left - Range("A" & Pos + 7 + position).Left '<-- largeur
L6 = Range("A" & Pos + 7 + position).Left '<-- position horizontale
T6 = Range("A" & Pos + 7 + position).Top '<-- position verticale
'Insertion de la zone de texte
'MsgBox (Desciption)
'ActiveSheet.Shapes.AddTextbox(msoTextOrientationHorizontal, 0, 0 + Position, D6, D1).Select
ActiveSheet.Shapes.AddTextbox(msoTextOrientationHorizontal, L, T, W, H).Select
With Selection
.Name = "ztxt1" '<-- nom de la zone de texte
.Characters.Text = "Désignation: " & Chr$(13) & Desciption '<-- texte
.HorizontalAlignment = xlLeft '<-- texte centré horizontalement
.VerticalAlignment = xlTop '<-- texte centré verticalement
'.ShapeRange.Fill.ForeColor.SchemeColor = 43 '<-- couleur de fond
.Font.Name = "Trebuchet MS"
.Font.Size = 14 '<-- taille de la police de caractères Trebuchet MS
.Font.Bold = True '<-- style gras
'.Font.Underline = xlUnderlineStyleSingle '<-- souligné
End With
'ActiveSheet.Shapes.AddTextbox(msoTextOrientationHorizontal, D6 + D5, 0 + Position, D7, D1).Select
ActiveSheet.Shapes.AddTextbox(msoTextOrientationHorizontal, L1, T1, W1, H1).Select
With Selection
.Name = "ztxt2" + Fiche '<-- nom de la zone de texte
.Characters.Text = "Fiche " & Chr$(13) & Fiche '<-- texte
.HorizontalAlignment = xlCenter '<-- texte centré horizontalement
.VerticalAlignment = xlTop '<-- texte centré verticalement
.ShapeRange.Line.Weight = 1.25 '<-- épaisseur du cadre
.ShapeRange.Fill.ForeColor.SchemeColor = 43 '<-- couleur de fond
.Font.Size = 18 '<-- taille de la police de caractères
.Font.Bold = True '<-- style gras
End With
'ActiveSheet.Shapes.AddTextbox(msoTextOrientationHorizontal, 0, D1 + D5 + Position, D8, D2).Select
ActiveSheet.Shapes.AddTextbox(msoTextOrientationHorizontal, L2, T2, W2, H2).Select
With Selection
.Name = "ztxt3" + Fiche '<-- nom de la zone de texte
.Characters.Text = "Raccordement technique à prévoir*:" '<-- texte
.HorizontalAlignment = xlLeft '<-- texte centré horizontalement
.VerticalAlignment = xlTop '<-- texte centré verticalement
'.ShapeRange.Fill.ForeColor.SchemeColor = 43 '<-- couleur de fond
.Font.Size = 12 '<-- taille de la police de caractères
.Font.Bold = True '<-- style gras
End With
'ActiveSheet.Shapes.AddTextbox(msoTextOrientationHorizontal, 0, D1 + D5 + D2 + D5 + Position, D8, D3 * 2).Select
ActiveSheet.Shapes.AddTextbox(msoTextOrientationHorizontal, L4, T4, W4, H4 + H5).Select
With Selection
.Name = "ztxt4" + Fiche '<-- nom de la zone de texte
.Characters.Text = "Quantité: " & Chr$(13) & Quantité & " " & Unit & Chr$(13) & "Dimensions:" & Chr$(13) & "Finitions:" & Chr$(13) & "Descriptif technique*:" & Chr$(13) & "Prestation:" '<-- texte
.HorizontalAlignment = xlLeft '<-- texte centré horizontalement
.VerticalAlignment = xlTop '<-- texte centré verticalement
'.ShapeRange.Fill.ForeColor.SchemeColor = 43 '<-- couleur de fond
.Font.Size = 12 '<-- taille de la police de caractères
.Font.Bold = True '<-- style gras
End With
'ActiveSheet.Shapes.AddTextbox(msoTextOrientationHorizontal, 0, D1 + D5 + D2 + D5 + D3 * 2 + D5 + Position, D8, D4).Select
ActiveSheet.Shapes.AddTextbox(msoTextOrientationHorizontal, L6, T6, W6, H6).Select
With Selection
.Name = "ztxt5" + Fiche '<-- nom de la zone de texte
.Characters.Text = "Remarques / modifications préconisées par l’entreprise*:" '<-- texte
.HorizontalAlignment = xlLeft '<-- texte centré horizontalement
.VerticalAlignment = xlTop '<-- texte centré verticalement
'.ShapeRange.Fill.ForeColor.SchemeColor = 43 '<-- couleur de fond
.Font.Size = 12 '<-- taille de la police de caractères
.Font.Bold = True '<-- style gras
End With
End Sub