Runtime Error 9 sur variable tableau - Indice hors limites (Erreur 9)

Bonjour à toutes et à tous,

Je n'arrive pas à comprendre ce qui génère l'erreur Indice hors limites (Erreur 9)

Une personne aguerrie pourrait-elle me l'expliquer ?

Merci par avance de toute l'aide que vous pourrez m'apporter

Eliotte

runtimeerror9

Portion de code concernée :

Option Explicit
Option Base 1
Const Template As String = "Template1.potm"
Const PrezGenerated As String = "Prez"
Const PrezFormat As String = ".potm"
Const FolderLayout As String = "\Toto\Template\"
Const FolderPrez As String = "\Toto\Prez\"
Public Source As Object, ParamFinder As Object, ParamTable() As Variant, PathFileLayout As String, PathSavePrez As String
Public ListItem

Sub XlToPpt()
Dim PPapp As Object, PPpres As Object, PPSlide As Object, Path As String
Dim XLws1 As Worksheet, MyArrayXLMaster() As Variant, XLObjExport() As Variant
Dim i As Long, ii As Long, y As Long

    PathFileLayout = ThisWorkbook.Path & FolderLayout & Template
    PathSavePrez = ThisWorkbook.Path & FolderPrez & PrezGenerated & "-" & Format(Date, "mmddyyyy") & "-" & Format(Time, "hhmmss") & PrezFormat

    Set Source = Worksheets("Dashboard")
        ListItem = Source.DashboardList.Value

    Set ParamFinder = Worksheets("DataXLToPpt")
        ParamTable = ParamFinder.ListObjects("E2PObjectDataTable").DataBodyRange.Value

    Set PPapp = CreateObject("PowerPoint.Application")
        FileCopy PathFileLayout, PathSavePrez

    Set PPpres = PPapp.Presentations.Open(PathSavePrez)
        PPapp.WindowState = 2
        PPapp.ActiveWindow.ViewType = 7

    For i = LBound(ParamTable) To UBound(ParamTable)
        MyArrayXLMaster = ParamFinder.ListObjects(ParamTable(i, 1)).DataBodyRange.Value
    Next i

Bonjour,

le problème semble lié à tes données, (une table manquante ?).

peux-tu nous mettre ton fichier (anonymisé si nécessaire) dans lequel on peut reproduire l'erreur ?

Bonjour h2so4,

Voici, j'ai purgé au maximum le fichier (qui ne ressemble plus à rien héhé)

Il faut créer une arborescence type ...

\Toto\Prez\ & \Toto\Template\

Merci pour votre aide.

Résolu.

En effet j'avais renommé l'un des tableaux et avais omis de le reporter dans le code.

Merci d'avoir répondu tout à l'heure.

Sujet clos

Rechercher des sujets similaires à "runtime error variable tableau indice hors limites erreur"