Bonjour, je voudrais appeler une macro ppt par excel.
Je savais le faire si j connaissais le nom du répertoire à la main; mais je vais vous coller mon code :
Voila , je sais que si je connais l'adresse il faut mettre:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 Public Sub ModifierPresentationExistantedb() Dim PptApp As PowerPoint.Application Dim PptDoc As PowerPoint.Presentation Set PptApp = CreateObject("Powerpoint.Application") PptApp.Visible = True With Application.FileSearch .NewSearch .LookIn = "G:\" .Filename = "DB*.ppt" .Execute Nombre_Fichier = .FoundFiles.Count For Each Fichier In .FoundFiles If Fichier = "G:\DB " & Format(Now, "yyyy - mm - dd") & "1.ppt" Then Fichier1 = Fichier ElseIf Fichier = "G:\DB " & Format(DateAdd("d", -1, Now), "yyyy - mm - dd") & "1.ppt" Then Fichier1 = Fichier ElseIf Fichier = "G:\DB " & Format(DateAdd("d", -2, Now), "yyyy - mm - dd") & "1.ppt" Then Fichier1 = Fichier ElseIf Fichier = "G:\DB " & Format(DateAdd("d", -3, Now), "yyyy - mm - dd") & "1.ppt" Then Fichier1 = Fichier End If Next If Fichier1 = "" Then MsgBox ("Fichier DB non trouvé") GoTo fin End If End With Set PptDoc = PptApp.Presentations.Open(Fichier1) With PptDoc PptDoc.Application.Run "Fichier1!SuppressionObjet" end with end sub
Mais avrec ma variable fichier1, je n'arrive pas à lancer ma macro ppt...
Code : Sélectionner tout - Visualiser dans une fenêtre à part PptDoc.Application.Run "'G:\DB 2008 - 04 - 091.ppt'!SuppressionObjet"
Si quelqu'un pouvait me dire comment faire...
merci d avance




Répondre avec citation

Partager