Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
1489 connectés 

  FORUM HardWare.fr
  Programmation
  VB/VBA/VBS

  Lancer une macro PPT à partir d'Excel

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

Lancer une macro PPT à partir d'Excel

n°1215911
RabahTheHu​t
Posté le 05-10-2005 à 19:38:57  profilanswer
 

Bonjour,
 
Je voudrai lancer une macro attaché à un document Power Point à partir d'un fichier Excel.  
Si je lance la macro de Power Point elle fonctionne, mais pas d’Excel, SAUF si je l’ai lancé au moins une fois de Power Point et que je n’ai pas fermé Power Point.
 
Le message d’erreur est le suivant :
“Application (unknown member) : Invalid request. Sub or function not defined.”
 
CODE :
D'excel :
 
Sub AutomatePowerPoint()
 
    Dim oPPTApp As PowerPoint.Application
    Dim oPPTPres As PowerPoint.Presentation
    Dim sPresentationFile As String
    sPresentationFile = "G:\BOITE\THT\Essai 1.PPT"
 
    Set oPPTApp = New PowerPoint.Application
    oPPTApp.Visible = True
    Set oPPTPres = oPPTApp.Presentations.Open(sPresentationFile)
    With oPPTPres = oPPTApp.Run("WechPPT" )
 
Lancement = oPPTApp.Run(“WechPPT”)
 
    End With
    Set oPPTPres = Nothing
    Set oPPTApp = Nothing
End Sub

 
 
 
Dans PowerPoint :
 
Public Sub WechPPT()
.....

mood
Publicité
Posté le 05-10-2005 à 19:38:57  profilanswer
 

n°1218366
Fred_l
Posté le 08-10-2005 à 17:13:02  profilanswer
 

Hé bé ça n'a pas été sans mal !!
M'enfin voilà :
 Set oPPT = CreateObject("PowerPoint.application" )
    oPPT.Visible = True
    Set PoPPT = oPPT.Presentations.Open("C:\PowerPoint.ppt" )
    ' La je lance la macro1() depuis excel dans PowerPont.ppt
    PoPPT.Application.Run "'PowerPoint.ppt'!Macro1"
 
 
Franchement j'ai cherché un bon moment avant de comprende pourquoi ca ne machait pas !... Hé oui, il faut "'Nom de la présentation' entre cote s'il vous plait puis !nom de la macro"...
Pourquoi faire simple quand on peut fair compliqué hein !
 
@+


Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation
  VB/VBA/VBS

  Lancer une macro PPT à partir d'Excel

 

Sujets relatifs
Aux specialistes des macros excel: tabulation automatique[EXCEL] Format de cellule de type n° hiérarchique
JE peux plus coier-coller dans excelpasser un fichier excel en fichier ascii
[Excel] Conditionner une source de données dans un graphiqueVC++7.1 - vararg macro
[Excel VBA] Ne pas afficher les lignes masquées d'un planMacro sous word
[PHP] GeoIP obtenir la ville a partir de l'IP[VB] Extraire un vecteur à partir d'une matrice sans boucle
Plus de sujets relatifs à : Lancer une macro PPT à partir d'Excel


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR