Insérer plusieurs parties d'un excel vers PWP
Fermé
Vouxy_90
-
13 juil. 2018 à 13:40
f894009 Messages postés 17215 Date d'inscription dimanche 25 novembre 2007 Statut Membre Dernière intervention 26 décembre 2024 - 15 juil. 2018 à 09:06
f894009 Messages postés 17215 Date d'inscription dimanche 25 novembre 2007 Statut Membre Dernière intervention 26 décembre 2024 - 15 juil. 2018 à 09:06
A voir également:
- Insérer plusieurs parties d'un excel vers PWP
- Insérer liste déroulante excel - Guide
- Formule excel pour additionner plusieurs cellules - Guide
- Insérer une vidéo dans powerpoint - Guide
- Insérer signature word - Guide
- Si et excel - Guide
1 réponse
f894009
Messages postés
17215
Date d'inscription
dimanche 25 novembre 2007
Statut
Membre
Dernière intervention
26 décembre 2024
1 711
15 juil. 2018 à 09:06
15 juil. 2018 à 09:06
Bonjour,
code modifie pour E/S en trois parties. A vous de positionner les Shapes
code modifie pour E/S en trois parties. A vous de positionner les Shapes
Sub District02_Create_Powerpoint() 'PURPOSE: Copy/Paste An Excel Range Into a New PowerPoint Presentation '-----------15/07/2018 -------------------- Dim rng(3) As Range Dim rngx As Range '-----------15/07/2018 -------------------- Dim PowerPointApp As Object Dim myPresentation As Object Dim mySlide As Object Dim myShape As Object Dim mySheet As Object Dim sPath As String Dim store_district As String 'Create an Instance of PowerPoint On Error Resume Next 'Is PowerPoint already opened? Set PowerPointApp = GetObject(class:="PowerPoint.Application") 'Clear the error between errors Err.Clear 'If PowerPoint is not already open then open PowerPoint If PowerPointApp Is Nothing Then Set PowerPointApp = CreateObject(class:="PowerPoint.Application") 'Handle if the PowerPoint Application is not found If Err.Number = 429 Then MsgBox "PowerPoint could not be found, aborting." Exit Sub End If On Error GoTo 0 'Optimize Code Application.ScreenUpdating = False 'Open Powerpoint file Set myPresentation = PowerPointApp.Presentations.Open(Filename:="H:\OSS_Shared\BPM-Retail\District Business Review\District_Business Review_Template_file.pptx") ' STORE ID '-------------------------15/07/2018----------------------- 'Copy Range from Excel Set rng(1) = ThisWorkbook.Worksheets("STORE ID").Range("E30:I56") Set rng(2) = ThisWorkbook.Worksheets("STORE ID").Range("J30:N56") Set rng(3) = ThisWorkbook.Worksheets("STORE ID").Range("O30:S56") 'Copy Excel Range en 3 parties For x = 1 To 3 rng(x).Copy 'Paste to PowerPoint and position Set mySlide = myPresentation.Slides(1) mySlide.Shapes.PasteSpecial DataType:=2 '2 = ppPasteEnhancedMetafile Set myShape = mySlide.Shapes(mySlide.Shapes.Count) 'Set size: myShape.Width = 650 'Set position: sngDefaultSlideWidth = myPresentation.PageSetup.SlideWidth sngDefaultSlideHeight = myPresentation.PageSetup.SlideHeight myShape.Left = (sngDefaultSlideWidth - myShape.Width) / 2 ' myShape.Left = 40 myShape.Top = 100 'Make PowerPoint Visible and Active PowerPointApp.Visible = True PowerPointApp.Activate 'Clear The Clipboard Application.CutCopyMode = False Next x '-------------------------------15/07/2018---------------------------------------------- ' GENERAL DASHBOARD 'Copy Range from Excel Set rngx = ThisWorkbook.Worksheets("HIGHLIGHTS - DASHBOARD").Range("D43:S70") 'Copy Excel Range rngx.Copy 'Paste to PowerPoint and position Set mySlide = myPresentation.Slides(6) mySlide.Shapes.PasteSpecial DataType:=2 '2 = ppPasteEnhancedMetafile Set myShape = mySlide.Shapes(mySlide.Shapes.Count) 'Set size: myShape.Width = 610 'Set position: sngDefaultSlideWidth = myPresentation.PageSetup.SlideWidth sngDefaultSlideHeight = myPresentation.PageSetup.SlideHeight myShape.Left = (sngDefaultSlideWidth - myShape.Width) / 2 ' myShape.Left = 40 myShape.Top = 100 'Make PowerPoint Visible and Active PowerPointApp.Visible = True PowerPointApp.Activate 'Clear The Clipboard Application.CutCopyMode = False End Sub