|
楼主 |
发表于 2011-7-1 14:27
|
显示全部楼层
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
② 以保持源格式的方式来插入
- Sub CopyWithSourceFormating()
- Dim oSource As Presentation
- Dim oTarget As Presentation
- Dim oSlide As Slide
- Dim dlgOpen As FileDialog
- Dim bMasterShapes As Boolean
- Dim i As Integer
- Dim FileName As String
- Set oTarget = ActivePresentation
- For i = 1 To 60
- FileName = "※※ (" & i & ").ppt" ’注 ※※为文件名称,包括路径
- Set oSource = Presentations.Open(FileName, , , False)
- For Each oSlide In oSource.Slides
- oSlide.Copy
- With oTarget.Slides.Paste
- .Design = oSlide.Design
- .ColorScheme = oSlide.ColorScheme
- If oSlide.FollowMasterBackground = False Then
- .FollowMasterBackground = False
- With .Background.Fill
- .Visible = oSlide.Background.Fill.Visible
- .ForeColor = oSlide.Background.Fill.ForeColor
- .BackColor = oSlide.Background.Fill.BackColor
- End With
- Select Case oSlide.Background.Fill.Type
- Case Is = msoFillTextured
- Select Case oSlide.Background.Fill.TextureType
- Case Is = msoTexturePreset
- .Background.Fill.PresetTextured _
- (oSlide.Background.Fill.PresetTexture)
- Case Is = msoTextureUserDefined
- End Select
- Case Is = msoFillSolid
- .Background.Fill.Transparency = 0#
- .Background.Fill.Solid
- Case Is = msoFillPicture
- With oSlide
- If .Shapes.Count > 0 Then .Shapes.Range.Visible = False
- bMasterShapes = .DisplayMasterShapes
- .DisplayMasterShapes = False
- .Export oSource.Path & .SlideID & ".png", "PNG"
- End With
- .Background.Fill.UserPicture _
- oSource.Path & oSlide.SlideID & ".png"
- Kill (oSource.Path & oSlide.SlideID & ".png")
- With oSlide
- .DisplayMasterShapes = bMasterShapes
- If .Shapes.Count > 0 Then .Shapes.Range.Visible = True
- End With
- Case Is = msoFillPatterned
- .Background.Fill.Patterned _
- (oSlide.Background.Fill.Pattern)
- Case Is = msoFillGradient
- Select Case oSlide.Background.Fill.GradientColorType
- Case Is = msoGradientTwoColors
- .Background.Fill.TwoColorGradient _
- oSlide.Background.Fill.GradientStyle, _
- oSlide.Background.Fill.GradientVariant
- Case Is = msoGradientPresetColors
- .Background.Fill.PresetGradient _
- oSlide.Background.Fill.GradientStyle, _
- oSlide.Background.Fill.GradientVariant, _
- oSlide.Background.Fill.PresetGradientType
- Case Is = msoGradientOneColor
- .Background.Fill.OneColorGradient _
- oSlide.Background.Fill.GradientStyle, _
- oSlide.Background.Fill.GradientVariant, _
- oSlide.Background.Fill.GradientDegree
- End Select
- Case Is = msoFillBackground
- End Select
- End If
- End With
- Next oSlide
- oSource.Close
- Set oSource = Nothing
- Next i
- End Sub
复制代码 |
评分
-
1
查看全部评分
-
|