Insertion d'un texte sur une image insérée dans un Range
Bonjour à tous
Je galère depuis de nombreuses heures, cherchant en vain dans l'aide en ligne, avec l'enregistreur de macros, sur Internet pour trouver la bonne syntaxe qui fonctionne pour réaliser mon projet:
j'ai inséré une image dans un range de quelques cellules qui s'appelle "LunZone".
Je souhaiterais insérer sur cette image un texte verticalement.
Pour cela j'essaie de mettre un textbox de nom "TexteLunZone" transparent dans lequel j'écris par exemple "Journée italienne".
Si je fais la manip avec l'enregistreur de macro, tout est correct, mais lorsque je l'intègre dans mon prog cela ne donne plus le résultat escompté.
J'ai fais un petit programme test pour faire mes essais:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
| Sub ToucheF9()
Dim i As Long
Dim RepertoirePhoto As String
RepertoirePhoto = "C:\Documents and Settings\Michel\Mes documents\Mes Images\"
Dim Nom As String
Nom = "PhotoTest"
Dim cel As Range
Dim sh As Shape
Set cel = Range("LunZone")
With ActiveSheet
.Pictures.Insert(RepertoirePhoto & Nom & ".jpg").Name = Nom
.Shapes(Nom).Left = cel.Left
.Shapes(Nom).Top = cel.Top
.Shapes(Nom).LockAspectRatio = msoFalse
.Shapes(Nom).Height = cel.Height
.Shapes(Nom).Width = cel.Width
.Shapes.AddTextbox(msoTextOrientationVertical, _
cel.Left, cel.Top, cel.Width, cel.Height).Select
Selection.Name = "TexteLunZone"
Set sh = .Shapes("TexteLunZone")
With sh
.Fill.Visible = msoFalse
.Fill.Solid
.Flip msoFlipVertical
.Fill.Transparency = 0#
.Line.Weight = 0.75
.Line.DashStyle = msoLineSolid
.Line.Style = msoLineSingle
.Line.Transparency = 0#
.Line.Visible = msoFalse
With .TextFrame
.Characters.Text = "Journée italienne"
.Characters(Start:=1, Length:=17).Font.Color = vbBlack
.Characters.Font.Name = "Monotype Corsiva"
.Characters.Font.Size = 36
.Characters.Font.Underline = xlUnderlineStyleNone
.Characters.Font.ColorIndex = xlAutomatic
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.ReadingOrder = xlContext
.Orientation = msoTextOrientationVertical
.AutoSize = False
MsgBox .Characters.Font.Name
End With
End With
End With
Set sh = Nothing
Set cel = Nothing
End Sub |
Si quelqu'un pouvait me dire où cela cloche
Merci
Michel