Erreur 1004 VBA (Office Mac 2011)

Bonjour à tous,

Je m'adresse à vous car je m'arrache les cheveux avec une VBA pour laquelle, à l'exécution, j'obtiens une erreur 1004.

Pourriez-vous m'aider ?

Sub Export_Powerpoint()

Dim appPpt As Object
Dim Pptpre As Object
Dim nbshpe As Byte
Dim shpe As Object
Dim sld As Object

Set appPpt = CreateObject("Powerpoint.Application")
appPpt.Visible = True

Set Pptpre = appPpt.Presentations.Add
Set sld = Pptpre.Slides.Add _
(Index:=1, Layout:=ppLayoutBlank)
Set sld = Pptpre.Slides.Add _
(Index:=2, Layout:=ppLayoutBlank)
Set sld = Pptpre.Slides.Add _
(Index:=3, Layout:=ppLayoutBlank)
Set sld = Pptpre.Slides.Add _
(Index:=4, Layout:=ppLayoutBlank)
Set sld = Pptpre.Slides.Add _
(Index:=5, Layout:=ppLayoutBlank)
Set sld = Pptpre.Slides.Add _
(Index:=6, Layout:=ppLayoutBlank)
Set sld = Pptpre.Slides.Add _
(Index:=7, Layout:=ppLayoutBlank)
Set sld = Pptpre.Slides.Add _
(Index:=8, Layout:=ppLayoutBlank)
Set sld = Pptpre.Slides.Add _
(Index:=9, Layout:=ppLayoutBlank)

ActiveSheet.ChartObjects(1).Select
Pptpre.Slides(1).Shapes.Paste
nbshpe = Pptpre.Slides(1).Shapes.Count
With Pptpre.Slides(1).Shapes(nbshpe)
    .Left = 150
    .Top = 190
    .Width = 400
    .Height = 300
 End With

Set shpe = Pptpre.Slides(1).Shapes. _
AddTextbox(msoTextOrientationHorizontal, _
30, 100, 600, 50)
With shpe.TextFrame.TextRange
    .Text = Range("F8")
    .Font.Name = "helvetica"
    .Font.Size = 14
    .Font.Bold = False
End With

ActiveSheet.ChartObjects(2).Select
Pptpre.Slides(2).Shapes.Paste
nbshpe = Pptpre.Slides(2).Shapes.Count
With Pptpre.Slides(2).Shapes(nbshpe)
    .Left = 150
    .Top = 190
    .Width = 400
    .Height = 300
 End With

Set shpe = Pptpre.Slides(2).Shapes. _
AddTextbox(msoTextOrientationHorizontal, _
30, 100, 600, 50)
With shpe.TextFrame.TextRange
    .Text = Range("F9")
    .Font.Name = "helvetica"
    .Font.Size = 14
    .Font.Bold = False
End With

ActiveSheet.ChartObjects(3).Select
Pptpre.Slides(3).Shapes.Paste
nbshpe = Pptpre.Slides(3).Shapes.Count
With Pptpre.Slides(3).Shapes(nbshpe)
    .Left = 150
    .Top = 190
    .Width = 400
    .Height = 300
 End With

Set shpe = Pptpre.Slides(3).Shapes. _
AddTextbox(msoTextOrientationHorizontal, _
30, 100, 600, 50)
With shpe.TextFrame.TextRange
    .Text = Range("F10")
    .Font.Name = "helvetica"
    .Font.Size = 14
    .Font.Bold = False
End With

ActiveSheet.ChartObjects(4).Select
Pptpre.Slides(4).Shapes.Paste
nbshpe = Pptpre.Slides(4).Shapes.Count
With Pptpre.Slides(4).Shapes(nbshpe)
    .Left = 150
    .Top = 190
    .Width = 400
    .Height = 300
 End With

Set shpe = Pptpre.Slides(4).Shapes. _
AddTextbox(msoTextOrientationHorizontal, _
30, 100, 600, 50)
With shpe.TextFrame.TextRange
    .Text = Range("F11")
    .Font.Name = "helvetica"
    .Font.Size = 14
    .Font.Bold = False
End With

ActiveSheet.ChartObjects(5).Select
Pptpre.Slides(5).Shapes.Paste
nbshpe = Pptpre.Slides(5).Shapes.Count
With Pptpre.Slides(5).Shapes(nbshpe)
    .Left = 150
    .Top = 190
    .Width = 400
    .Height = 300
 End With

Set shpe = Pptpre.Slides(5).Shapes. _
AddTextbox(msoTextOrientationHorizontal, _
30, 100, 600, 50)
With shpe.TextFrame.TextRange
    .Text = Range("F12")
    .Font.Name = "helvetica"
    .Font.Size = 14
    .Font.Bold = False
End With

ActiveSheet.ChartObjects(6).Select
Pptpre.Slides(6).Shapes.Paste
nbshpe = Pptpre.Slides(6).Shapes.Count
With Pptpre.Slides(6).Shapes(nbshpe)
    .Left = 150
    .Top = 190
    .Width = 400
    .Height = 300
 End With

Set shpe = Pptpre.Slides(6).Shapes. _
AddTextbox(msoTextOrientationHorizontal, _
30, 100, 600, 50)
With shpe.TextFrame.TextRange
    .Text = Range("F13")
    .Font.Name = "helvetica"
    .Font.Size = 14
    .Font.Bold = False
End With

ActiveSheet.ChartObjects(7).Select
Pptpre.Slides(7).Shapes.Paste
nbshpe = Pptpre.Slides(7).Shapes.Count
With Pptpre.Slides(7).Shapes(nbshpe)
    .Left = 150
    .Top = 190
    .Width = 400
    .Height = 300
 End With

Set shpe = Pptpre.Slides(7).Shapes. _
AddTextbox(msoTextOrientationHorizontal, _
30, 100, 600, 50)
With shpe.TextFrame.TextRange
    .Text = Range("F14")
    .Font.Name = "helvetica"
    .Font.Size = 14
    .Font.Bold = False
End With

ActiveSheet.ChartObjects(8).Select
Pptpre.Slides(8).Shapes.Paste
nbshpe = Pptpre.Slides(8).Shapes.Count
With Pptpre.Slides(8).Shapes(nbshpe)
    .Left = 50
    .Top = 120
    .Width = 600
    .Height = 350
 End With

Set shpe = Pptpre.Slides(8).Shapes. _
AddTextbox(msoTextOrientationHorizontal, _
20, 50, 600, 50)
With shpe.TextFrame.TextRange
    .Text = Range("F15")
    .Font.Name = "helvetica"
    .Font.Size = 14
    .Font.Bold = False
End With

ActiveSheet.ChartObjects(9).Select
Pptpre.Slides(9).Shapes.Paste
nbshpe = Pptpre.Slides(9).Shapes.Count
With Pptpre.Slides(9).Shapes(nbshpe)
    .Left = 50
    .Top = 120
    .Width = 600
    .Height = 350
 End With

Set shpe = Pptpre.Slides(9).Shapes. _
AddTextbox(msoTextOrientationHorizontal, _
20, 50, 600, 50)
With shpe.TextFrame.TextRange
    .Text = Range("F16")
    .Font.Name = "helvetica"
    .Font.Size = 14
    .Font.Bold = False
End With

Set appPpt = Nothing

End Sub

Merci d'avance !

Bonjour

L'erreur se produit à quel endroit du code ?

Cordialement

Bonjour Dan,

A priori, cela bloque dès la première ligne.

Alice

re

Possible d'avoir votre fichier ? Ce sera plus simple je pense

Cordialement

Rechercher des sujets similaires à "erreur 1004 vba office mac 2011"