Bonjour,
J'ai tapé le code suivant qui fonctionne bien, les box de mon userform viennent alimenter des shapes dans un slide powerpoint. Mon problème c'est que certaines de ces box sont vides. Lorsque la textbox est vide, j'aimerais ne pas avoir de retour à la ligne (vbCrLf).
Merci d'avance pour vos idées.
Private Sub ouvrirppt_Click()
S = langue.Value
Dim FichierPpt, pwpt, presppt
Set pwpt = CreateObject("PowerPoint.Application")
pwpt.Visible = True
Set presppt = pwpt.Presentations.Open(Filename:=ThisWorkbook.Path & "\" & "presentation.pptx")
pwpt.Visible = True
With presppt
Dim I As Byte
With .Slides(1).Shapes("Text Box 46").TextFrame.TextRange
.text = nom & vbCrLf & Box2 & Box3 & vbCrLf & "Tel.: " & Box4 & "Email: " & Box7
With .Characters(1, Len(nom)).Font
.Size = 15
.Bold = True
End With
End With
.Slides(1).Shapes("Text Box 11").TextFrame.TextRange.text = Box17
With .Slides(1).Shapes("Text Box 6").TextFrame.TextRange
.text = Box12 & " " & Label5.Caption & vbCrLf & Box13 & vbCrLf & Box14 & vbCrLf & Box15 & vbCrLf & Box16 _
& vbCrLf & Box8 & vbCrLf & Box9 & vbCrLf & Box10 & vbCrLf & Box11 _
& vbCrLf & Box18 & vbCrLf & Box19 & vbCrLf & Box20 & vbCrLf & Box21
With .Characters(1, Len(Box12) + Len(Label5.Caption) + 1).Font
.Size = 10
.Bold = True
End With
With .Characters(Len(Box12) + Len(Label5.Caption) + 1, Len(Box13) + 1).Font
.Size = 9
.Bold = False
End With
With .Paragraphs(2)
.ParagraphFormat.Bullet.Type = ppBulletUnnumbered
End With
With .Paragraphs(3)
.ParagraphFormat.Bullet.Type = ppBulletUnnumbered
End With
With .Paragraphs(4)
.ParagraphFormat.Bullet.Type = ppBulletUnnumbered
End With
End With
End With
End Sub
J'ai tapé le code suivant qui fonctionne bien, les box de mon userform viennent alimenter des shapes dans un slide powerpoint. Mon problème c'est que certaines de ces box sont vides. Lorsque la textbox est vide, j'aimerais ne pas avoir de retour à la ligne (vbCrLf).
Merci d'avance pour vos idées.
Private Sub ouvrirppt_Click()
S = langue.Value
Dim FichierPpt, pwpt, presppt
Set pwpt = CreateObject("PowerPoint.Application")
pwpt.Visible = True
Set presppt = pwpt.Presentations.Open(Filename:=ThisWorkbook.Path & "\" & "presentation.pptx")
pwpt.Visible = True
With presppt
Dim I As Byte
With .Slides(1).Shapes("Text Box 46").TextFrame.TextRange
.text = nom & vbCrLf & Box2 & Box3 & vbCrLf & "Tel.: " & Box4 & "Email: " & Box7
With .Characters(1, Len(nom)).Font
.Size = 15
.Bold = True
End With
End With
.Slides(1).Shapes("Text Box 11").TextFrame.TextRange.text = Box17
With .Slides(1).Shapes("Text Box 6").TextFrame.TextRange
.text = Box12 & " " & Label5.Caption & vbCrLf & Box13 & vbCrLf & Box14 & vbCrLf & Box15 & vbCrLf & Box16 _
& vbCrLf & Box8 & vbCrLf & Box9 & vbCrLf & Box10 & vbCrLf & Box11 _
& vbCrLf & Box18 & vbCrLf & Box19 & vbCrLf & Box20 & vbCrLf & Box21
With .Characters(1, Len(Box12) + Len(Label5.Caption) + 1).Font
.Size = 10
.Bold = True
End With
With .Characters(Len(Box12) + Len(Label5.Caption) + 1, Len(Box13) + 1).Font
.Size = 9
.Bold = False
End With
With .Paragraphs(2)
.ParagraphFormat.Bullet.Type = ppBulletUnnumbered
End With
With .Paragraphs(3)
.ParagraphFormat.Bullet.Type = ppBulletUnnumbered
End With
With .Paragraphs(4)
.ParagraphFormat.Bullet.Type = ppBulletUnnumbered
End With
End With
End With
End Sub