VBA批量导入多个文件夹下的图片到PPT

1.需要导入到PPT的照片文件夹
VBA批量导入多个文件夹下的图片到PPT_第1张图片

  1. Coding
Sub InsertPicture()
Dim oPPT As Presentation
Dim oSlide As Slide
Dim nSlide As Byte
Dim oCL As CustomLayout
Dim Shp As Shape
Dim myFile
Dim filearr()
Dim filearr0()
Dim myPath As String
Dim sPath As String
Dim FileName As String
Dim files As String
Dim x As String
Set oPPT = PowerPoint.ActivePresentation
'sPath = "C:\Users\Desktop\VBA\Outbound Loading Audit 10.31\"
    
With oPPT
nSlide = .Slides.Count
    With oSlide
    
       For j = 2 To nSlide
            Set oSlide = ActivePresentation.Slides(j)
            oSlide.Select  '选定当前ppt
            '以上为遍历每个PPT
'-------------------------------------------------------------------------------------------

                myPath = Dir("C:\Users\jishen\Desktop\VBA\Outbound Loading Audit 10.31\", vbDirectory)   'vbDirectory只看文件夹
                Do While myPath <> ""
                    ReDim Preserve filearr0(k)
                    filearr0(k) 

你可能感兴趣的:(VBA,PPT,vba,ppt)