ExcelHome技术论坛

 找回密码
 免费注册

QQ登录

只需一步,快速开始

快捷登录

搜索
EH技术汇-专业的职场技能充电站 妙哉!函数段子手趣味讲函数 Excel服务器-会Excel,做管理系统 效率神器,一键搞定繁琐工作
HR薪酬管理数字化实战 Excel 2021函数公式学习大典 Excel数据透视表实战秘技 打造核心竞争力的职场宝典
让更多数据处理,一键完成 数据工作者的案头书 免费直播课集锦 ExcelHome出品 - VBA代码宝免费下载
用ChatGPT与VBA一键搞定Excel WPS表格从入门到精通 Excel VBA经典代码实践指南
楼主: weiyingde

[分享] ppt学习资料

[复制链接]

TA的精华主题

TA的得分主题

 楼主| 发表于 2015-12-30 08:14 | 显示全部楼层
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用  · 内置多项VBA编程加强工具       ★ 免费下载 ★      ★使用手册
BuiltInDocumentProperties属性
返回一个 DocumentProperties集合,该集合代表指定演示文稿的所有内置文档属性。只读。
有关返回集合中单个元素的详细信息,请参阅返回集合中的对象。
说明
使用CustomDocumentProperties属性返回自定义文档属性的集合。
VBA示例
本示例显示当前演示文稿的所有内置文档属性的名称。
For Each p In Application.ActivePresentation _
        .BuiltInDocumentProperties
    bidpList = bidpList & p.Name & Chr$(13)
Next
MsgBox bidpList
如果演示文稿的作者为“Jake Jarmel”,本示例为该文稿设定内置文档属性“Category”的值。
With Application.ActivePresentation.BuiltInDocumentProperties
    If .Item("author").Value = "Jake Jarmel" Then
        .Item("category").Value = "Creative Writing"
    End If
End With
Bullet属性
返回一个BulletFormat对象,该对象代表为指定的段落格式设定的项目符号格式。只读。
VBA示例
本示例设定当前演示文稿第一张幻灯片的第二个形状中段落的项目符号大小和颜色。
With Application.ActivePresentation.Slides(1).Shapes(2).TextFrame
    With .TextRange.ParagraphFormat.Bullet
        .Visible = True
        .RelativeSize = 1.25
        .Font.Color = RGB(255, 0, 255)
    End With
End With
By属性
应用于 ColorEffect对象的 By属性。
返回 ColorFormat对象,该对象代表对象的颜色更改为以 RGB 格式表示的指定数值。
expression.By
expression  必选。该表达式返回一个 ColorEffect对象。
应用于 RotationEffect对象的 By属性。
设置或返回 Single 类型值,该值代表对象旋转的指定度数;例如,数值 180 表示对象旋转 180 度。可读写。
expression.By
expression  必选。该表达式返回一个 RotationEffect对象。
说明
指定的对象将围绕其中心旋转,其中心在屏幕上的位置保持不变。
如果同时设置了旋转效果的 By 和To属性,则 By属性的值将被忽略。
浮点数有效(例如 55.5),但是负数无效。
说明
请勿将此属性与ScaleEffect 和MotionEffect对象的ByX 或ByY属性相混淆,后者仅用于缩放或动作效果。
VBA示例
应用于 ColorEffect对象。
本示例添加颜色效果并且更改其颜色。本示例假设当前演示文稿的第一张幻灯片中至少有一个形状。
Sub AddAndChangeColorEffect()
    Dim effBlinds As Effect
    Dim tmlnShape As TimeLine
    Dim shpShape As Shape
    Dim animBehavior As AnimationBehavior
    Dim clrEffect As ColorEffect
    'Sets shape, timing, and effect
    Set shpShape = ActivePresentation.Slides(1).Shapes(1)
    Set tmlnShape = ActivePresentation.Slides(1).TimeLine
    Set effBlinds = tmlnShape.MainSequence.AddEffect _
        (Shape:=shpShape, effectId:=msoAnimEffectBlinds)
    'Adds animation behavior and color effect
    Set animBehavior = tmlnShape.MainSequence(1).Behaviors _
        .Add(Type:=msoAnimTypeColor)
    Set clrEffect = animBehavior.ColorEffect
    'Specifies color
    clrEffect.By.RGB = RGB(Red:=255, Green:=0, Blue:=0)
End Sub
应用于 RotationEffect对象。
本示例添加旋转效果并且更改其旋转方式。
Sub AddAndChangeRotationEffect()
    Dim effBlinds As Effect
    Dim tmlnShape As TimeLine
    Dim shpShape As Shape
    Dim animBehavior As AnimationBehavior
    Dim rtnEffect As RotationEffect
    'Sets shape, timing, and effect
    Set shpShape = ActivePresentation.Slides(1).Shapes(1)
    Set tmlnShape = ActivePresentation.Slides(1).TimeLine
    Set effBlinds = tmlnShape.MainSequence.AddEffect _
        (Shape:=shpShape, effectId:=msoAnimEffectBlinds)
    'Adds animation behavior and sets rotation effect
    Set animBehavior = tmlnShape.MainSequence(1).Behaviors _
        .Add(Type:=msoAnimTypeRotation)
    Set rtnEffect = animBehavior.RotationEffect
    rtnEffect.By = 270
End Sub

TA的精华主题

TA的得分主题

 楼主| 发表于 2015-12-30 08:55 | 显示全部楼层
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用  · 内置多项VBA编程加强工具       ★ 免费下载 ★      ★使用手册
ByX属性
设置或返回 Single 类型值,该值代表按指定的屏幕宽度百分比水平缩放或移动对象,缩放或移动取决于该属性是与MotionEffect对象还是与ScaleEffect对象联合使用。例如,动作效果值 50 表示将对象向右移动屏幕宽度一半的距离。可读写。
expression.ByX
expression  必选。该表达式返回“应用于”列表中的对象之一。
说明
负数表示水平向左移动对象。浮点数(例如 55.5)有效。
若要垂直缩放或移动对象,请使用ByY属性。
如果同时设置 ByX 和 ByY属性,则可以在水平和垂直两个方向缩放或移动对象。
请勿将此属性与ColorEffect、RotationEffect 或PropertyEffect对象的By属性相混淆,它们分别用于设置动画动作的颜色、旋转或其他属性。
VBA示例
以下示例添加了一个动画路径;然后设置形状在水平和垂直方向上的移动。
Sub AddMotionPath()
    Dim effCustom As Effect
    Dim animBehavior As AnimationBehavior
    Dim shpRectangle As Shape
    'Adds rectangle and sets effect and animation
    Set shpRectangle = ActivePresentation.Slides(1).Shapes _
        .AddShape(Type:=msoShapeRectangle, Left:=300, _
        Top:=300, Width:=300, Height:=150)
    Set effCustom = ActivePresentation.Slides(1).TimeLine _
        .MainSequence.AddEffect(Shape:=shpRectangle, _
         effectId:=msoAnimEffectCustom)
    Set animBehavior = effCustom.Behaviors.Add(msoAnimTypeMotion)
    'Specifies animation motion
    With animBehavior.MotionEffect
        .ByX = 50
        .ByY = 50
    End With
End Sub
ByY属性
设置或返回 Single 类型值,该值代表按指定的屏幕宽度百分比垂直缩放或移动对象,它取决于MotionEffect对象是与ScaleEffect 联合使用,还是分别使用。可读写。
expression.ByY
expression  必选。该表达式返回“应用于”列表中的对象之一。
说明
负数表示水平向左移动对象。浮点数(例如 55.5)有效。
若要水平缩放或移动对象,请使用ByX属性。
如果同时设置 ByX 和 ByY属性,则可以在水平和垂直两个方向缩放或移动对象。
请勿将此属性与ColorEffect、RotationEffect 或PropertyEffect对象的By属性相混淆,它们分别用于设置动画动作的颜色、旋转或其他属性。
VBA示例
以下示例添加了一个动画路径;然后设置形状在水平和垂直方向上的移动。
Sub AddMotionPath()
    Dim effCustom As Effect
    Dim animBehavior As AnimationBehavior
    Dim shpRectangle As Shape
    'Adds rectangle and sets effect and animation
    Set shpRectangle = ActivePresentation.Slides(1).Shapes _
        .AddShape(Type:=msoShapeRectangle, Left:=300, _
        Top:=300, Width:=300, Height:=150)
    Set effCustom = ActivePresentation.Slides(1).TimeLine _
        .MainSequence.AddEffect(Shape:=shpRectangle, _
         effectId:=msoAnimEffectCustom)
    Set animBehavior = effCustom.Behaviors.Add(msoAnimTypeMotion)
    'Specifies animation motion
    With animBehavior.MotionEffect
        .ByX = 50
        .ByY = 50
    End With
End Sub
Callout属性
返回一个CalloutFormat对象,该对象包含指定形状的标注格式属性。应用于代表行标注的 Shape 或 ShapeRange对象。只读。
VBA示例
本示例在myDocument 中添加一个椭圆和指向该椭圆的标注。标注文本没有边界,但包含垂直强调线将文本与标注线分开。
Set myDocument = ActivePresentation.Slides(1)
With myDocument.Shapes
    .AddShape msoShapeOval, 180, 200, 280, 130
    With .AddCallout(msoCalloutTwo, 420, 170, 170, 40)
        .TextFrame.TextRange.Text = "My oval"
        With .Callout
            .Accent = True
            .Border = False
        End With
    End With
End With

TA的精华主题

TA的得分主题

 楼主| 发表于 2015-12-30 08:56 | 显示全部楼层
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件       ★免费下载 ★       ★ 使用帮助
Caption属性
应用于 Application对象的 Caption属性。
返回出现在应用程序窗口的标题栏中的文本。可读写。String 类型。
expression.Caption
expression  必选。该表达式返回上述对象之一。
应用于 DocumentWindow对象的 Caption属性。
返回出现在文档窗口的标题栏中的文本。只读。String 类型。
expression.Paste
expression  必选。该表达式返回上述对象之一。
VBA示例
本示例显示每个打开的文档窗口的标题。
With Application.Windows
    For w = 1 To .Count
        MsgBox "Window " & w & " contains " & .Item(1).Caption
    Next
End With
Cells属性
返回CellRange集合,它代表表格列或行中的单元格。只读。
有关返回集合中单个元素的详细信息,请参阅返回集合中的对象。
VBA示例
本示例新建一个演示文稿,接着为其添加一张幻灯片,然后在幻灯片上插入一个 3x3 的表格,最后为表格中的每个单元格指定列号和行号。
Dim i As Integer
Dim j As Integer
With Presentations.Add
    .Slides.Add(1, ppLayoutBlank).Shapes.AddTable(3, 3).Select
    Set myTable = .Slides(1).Shapes(1).Table
    For i = 1 To myTable.Columns.Count
        For j = 1 To myTable.Columns(i).Cells.Count
            myTable.Columns(i).Cells(j).Shape.TextFrame _
                .TextRange.Text = "col. " & i & "row " & j
        Next j
    Next i
End With
Character属性
返回或设置在指定文本中用作项目符号的 Unicode 字符值。可读写。Long 类型。
VBA示例
本示例为当前演示文稿第一张幻灯片的第二个形状设置项目符号字符。
Set frame2 = ActivePresentation.Slides(1).Shapes(2).TextFrame
With frame2.TextRange.ParagraphFormat.Bullet
    .Character = 8226
    .Visible = True
End With
ChartUnitEffect属性
返回或设置一个值,该值指出图表范围是按序列、类别、还是按元素动画显示。可读写。PpChartUnitEffect 类型。
PpChartUnitEffect 可以是下列 PpChartUnitEffect 类型常数之一。
ppAnimateByCategory
ppAnimateByCategoryElements
ppAnimateBySeries
ppAnimateBySeriesElements
ppAnimateChartAllAtOnce
ppAnimateChartMixed
expression.ChartUnitEffect
expression  必选。该表达式返回“应用于”列表中的对象之一。
说明
如果图表不出现动画效果,请确保将Animate属性设为 True。
VBA示例
本示例设置当前演示文稿第三张幻灯片的第二个形状按序列动画显示。为使本示例运行,第二个形状必须为一个图表。
With ActivePresentation.Slides(3).Shapes(2)
    With .AnimationSettings
        .ChartUnitEffect = ppAnimateBySeries
        .EntryEffect = ppEffectFlyFromLeft
        .Animate = True
    End With
End With

TA的精华主题

TA的得分主题

 楼主| 发表于 2015-12-30 08:57 | 显示全部楼层
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件       ★免费下载 ★       ★ 使用帮助
CheckIfOfficeIsHTMLEditor属性
决定 Microsoft PowerPoint 在启动 PowerPoint 时,是否检查 Office 应用程序是默认的 HTML 编辑器。可读写。MsoTriState 类型。
MsoTriState 可以是下列 MsoTriState 类型常数之一。
msoCTrue
msoFalse 启动 PowerPoint 时,PowerPoint 不检查 Office 应用程序是否为默认的 HTML 编辑器。
msoTriStateMixed
msoTriStateToggle
msoTrue 默认值。启动 PowerPoint 时,PowerPoint 检查 Office 应用程序是否为默认的 HTML 编辑器。
说明
仅当所使用的 Web 浏览器支持 HTML 编辑和 HTML 编辑器时,才使用此属性。
如果需要使用其他 HTML 编辑器,则用户必须将此属性设置为 False,然后将该编辑器注册为默认的系统 HTML 编辑器。
VBA示例
本示例使 Microsoft PowerPoint 不检查 Office 应用程序是否为默认的 HTML 编辑器。
Application.DefaultWebOptions.CheckIfOfficeIsHTMLEditor = msoFalse
Child属性
如果该形状是子形状,或者如果形状范围内的所有形状都是同一个父形状的子形状,则属性值为 MsoTrue。只读。MsoTriState 类型。
MsoTriState 可以是下列 MsoTriState 类型常数之一。
msoCTrue 不应用于此属性。
msoFalse 该形状不是子形状,或者形状范围内并非所有的子形状都属于同一个父形状。
msoTriStateMixed 不应用于此属性。
msoTriStateToggle 不应用于此属性。
msoTrue 该形状是子形状,或者形状范围内所有的子形状都属于同一个父形状。
expression.Child
expression  必选。该表达式返回“应用于”列表中的对象之一。
VBA示例
本示例选择了画布中的第一个形状,如果选定的形状是子形状,则用指定的颜色填充该形状。本示例假设当前演示文稿中的第一个形状是包含多个形状的绘图画布。
Sub FillChildShape()
    'Select the first shape in the drawing canvas
    ActivePresentation.Slides(1).Shapes(1).CanvasItems(1).Select
    'Fill selected shape if it is a child shape
    With ActiveWindow.Selection
        If .ShapeRange.Child = msoTrue Then
            .ShapeRange.Fill.ForeColor.RGB = RGB(Red:=100, Green:=0, Blue:=200)
        Else
            MsgBox "This shape is not a child shape."
        End If
    End With
End Sub
Children属性
返回DiagramNodeChildren对象,该对象代表指定图示节点的所有子节点。
expression.Children
expression 必选。该表达式返回“应用于”列表中的对象之一。
VBA示例
以下示例创建了一个棱锥图并向该图示添加子节点。
Sub CreatePyramidDiagram()
    Dim dgnNode As DiagramNode
    Dim shpDiagram As Shape
    Dim intNodes As Integer
    'Adds pyramid diagram and first child node
    Set shpDiagram = ActivePresentation.Slides(1).Shapes _
        .AddDiagram(Type:=msoDiagramPyramid, Left:=10, _
        Top:=15, Width:=400, Height:=475)
    Set dgnNode = shpDiagram.DiagramNode.Children.AddNode
    'Adds three additional child nodes to diagram
    For intNodes = 1 To 3
        dgnNode.AddNode
    Next intNodes
End Sub
ChildShapeRange属性
返回ShapeRange对象,该对象代表选定形状的子形状的。
expression.ChildShapeRange
expression  必选。该表达式返回“应用于”列表中的对象之一。
VBA示例
本示例用绘图画布创建新文档,再向绘图画布中添加形状,并选择添加到画布上的形状。然后,在确认选定的形状为子形状后使用图案填充该子形状。
Sub ChildShapes()
    Dim sldNew As Slide
    Dim shpCanvas As Shape
    'Create a new slide with a drawing canvas and shapes
    Set sldNew = Presentations(1).Slides _
        .Add(Index:=1, Layout:=ppLayoutBlank)
    Set shpCanvas = sldNew.Shapes.AddCanvas( _
        Left:=100, Top:=100, Width:=200, Height:=200)
    With shpCanvas.CanvasItems
        .AddShape msoShapeRectangle, Left:=0, Top:=0, _
            Width:=100, Height:=100
        .AddShape msoShapeOval, Left:=0, Top:=50, _
            Width:=100, Height:=100
        .AddShape msoShapeDiamond, Left:=0, Top:=100, _
            Width:=100, Height:=100
    End With
    'Select all shapes in the canvas
    shpCanvas.CanvasItems.SelectAll
    'Fill canvas child shapes with a pattern
    With ActiveWindow.Selection
        If .HasChildShapeRange = True Then
            .ChildShapeRange.Fill.Patterned Pattern:=msoPatternDivot
        Else
            MsgBox "This is not a range of child shapes."
        End If
    End With
End Sub

TA的精华主题

TA的得分主题

 楼主| 发表于 2015-12-30 08:59 | 显示全部楼层
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件       ★免费下载 ★       ★ 使用帮助
ChildShapeRange属性
返回ShapeRange对象,该对象代表选定形状的子形状的。
expression.ChildShapeRange
expression  必选。该表达式返回“应用于”列表中的对象之一。
VBA示例
本示例用绘图画布创建新文档,再向绘图画布中添加形状,并选择添加到画布上的形状。然后,在确认选定的形状为子形状后使用图案填充该子形状。
Sub ChildShapes()
    Dim sldNew As Slide
    Dim shpCanvas As Shape
    'Create a new slide with a drawing canvas and shapes
    Set sldNew = Presentations(1).Slides _
        .Add(Index:=1, Layout:=ppLayoutBlank)
    Set shpCanvas = sldNew.Shapes.AddCanvas( _
        Left:=100, Top:=100, Width:=200, Height:=200)
    With shpCanvas.CanvasItems
        .AddShape msoShapeRectangle, Left:=0, Top:=0, _
            Width:=100, Height:=100
        .AddShape msoShapeOval, Left:=0, Top:=50, _
            Width:=100, Height:=100
        .AddShape msoShapeDiamond, Left:=0, Top:=100, _
            Width:=100, Height:=100
    End With
    'Select all shapes in the canvas
    shpCanvas.CanvasItems.SelectAll
    'Fill canvas child shapes with a pattern
    With ActiveWindow.Selection
        If .HasChildShapeRange = True Then
            .ChildShapeRange.Fill.Patterned Pattern:=msoPatternDivot
        Else
            MsgBox "This is not a range of child shapes."
        End If
    End With
End Sub
Collate属性
决定是否在打印下一副本的第一页之前打印指定演示文稿的完整副本。可读写。MsoTriState 类型。
MsoTriState 可以是下列 MsoTriState 类型常数之一。
msoCTrue
msoFalse
msoTriStateMixed
msoTriStateToggle
msoTrue 默认值。在打印下一副本的第一页之前打印指定演示文稿的完整副本。
说明
为PrintOut方法的 Collate参数指定一个值,以设置该属性的值。
VBA示例
本示例逐份打印当前演示文稿的三个对照副本。
With ActivePresentation.PrintOptions
    .NumberOfCopies = 3
    .Collate = msoTrue
    .Parent.PrintOut
End With

TA的精华主题

TA的得分主题

 楼主| 发表于 2015-12-30 09:00 | 显示全部楼层
Color属性
返回一个ColorFormat 对象,该对象代表指定字符的背景色。只读。
VBA示例
本示例设置第一张幻灯片的标题中的第一到第五个字符的颜色。
myRed = RGB(255, 0, 0)
Set myT = Application.ActivePresentation.Slides(1).Shapes.Title
myT.TextFrame.TextRange.Characters(1, 5).Font.Color.RGB = myRed
Color2属性
返回ColorFormat对象,该对象代表颜色循环动画的结束颜色。
expression.Color2
expression  必选。该表达式返回“应用于”列表中的对象之一。
说明
Color1属性返回起始颜色。
VBA示例
以下示例添加一个形状,并向该形状添加填充动画,然后报告起始填充颜色和结束填充颜色。
Sub SetStartEndColors()
    Dim effChangeFill As Effect
    Dim shpCube As Shape
    Dim a As AnimationBehavior
    'Adds cube and set fill effect
    Set shpCube = ActivePresentation.Slides(1).Shapes _
        .AddShape(Type:=msoShapeCube, Left:=300, _
        Top:=300, Width:=100, Height:=100)
    Set effChangeFill = ActivePresentation.Slides(1).TimeLine _
        .MainSequence.AddEffect(Shape:=shpCube, _
        effectId:=msoAnimEffectChangeFillColor)
    'Sets duration of effect and displays a message containing
    'the starting and ending colors for the fill effect
    effChangeFill.Timing.Duration = 3
    MsgBox "Start Color = " & effChangeFill.EffectParameters _
        .Color1 & vbCrLf & "End Color = " & effChangeFill _
        .EffectParameters.Color2
End Sub
ColorEffect属性
返回ColorEffect对象,该对象代表指定动画动作的颜色属性。
expression.ColorEffect
expression  必选。该表达式返回“应用于”列表中的对象之一。
VBA示例
本示例在当前演示文稿的第一张幻灯片中添加一个形状,并且设置一种颜色效果动作以更改新形状的填充颜色。
Sub ChangeColorEffect()
    Dim sldFirst As Slide
    Dim shpHeart As Shape
    Dim effNew As Effect
    Dim bhvEffect As AnimationBehavior
    Set sldFirst = ActivePresentation.Slides(1)
    Set shpHeart = sldFirst.Shapes.AddShape(Type:=msoShapeHeart, _
        Left:=100, Top:=100, Width:=100, Height:=100)
    Set effNew = sldFirst.TimeLine.MainSequence.AddEffect _
        (Shape:=shpHeart, EffectID:=msoAnimEffectChangeFillColor, _
        Trigger:=msoAnimTriggerAfterPrevious)
    Set bhvEffect = effNew.Behaviors.Add(Type:=msoAnimTypeColor)
    With bhvEffect.ColorEffect
        .From.RGB = RGB(Red:=255, Green:=0, Blue:=0)
        .To.RGB = RGB(Red:=0, Green:=0, Blue:=255)
    End With
End Sub

TA的精华主题

TA的得分主题

 楼主| 发表于 2015-12-30 09:01 | 显示全部楼层
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用  · 内置多项VBA编程加强工具       ★ 免费下载 ★      ★使用手册
ColorScheme属性
返回或设置ColorScheme对象,该对象代表指定幻灯片、幻灯片区域或幻灯片母版的配色方案。可读写。
VBA示例
本示例将当前演示文稿第一张和第三张幻灯片的标题颜色设为绿色。
Set mySlides = ActivePresentation.Slides.Range(Array(1, 3))
mySlides.ColorScheme.Colors(ppTitle).RGB = RGB(0, 255, 0)
ColorSchemes属性
返回一个ColorSchemes集合,该集合代表指定演示文稿的配色方案。只读。
VBA示例
本示例为当前演示文稿的配色方案三设定背景色,并将配色方案应用于基于幻灯片母版的演示文稿中所有的幻灯片。
With ActivePresentation
    Set cs1 = .ColorSchemes(3)
    cs1.Colors(ppBackground).RGB = RGB(128, 128, 0)
    .SlideMaster.ColorScheme = cs1
End With
ColorType属性
返回或设置应用于指定图片或 OLE对象的颜色转换类型。可读写。MsoPictureColorType 类型。
MsoPictureColorType 可以是下列 MsoPictureColorType 类型常数之一。
msoPictureAutomatic
msoPictureBlackAndWhite
msoPictureGrayscale
msoPictureMixed
msoPictureWatermark
expression.ColorType
expression  必选。该表达式返回“应用于”列表中的对象之一。
VBA示例
本例将myDocument 的第一个形状的颜色转换设置为灰度。第一个形状必须是图片或 OLE对象。
Set myDocument = ActivePresentation.Slides(1)
myDocument.Shapes(1).PictureFormat.ColorType = msoPictureGrayScale
Columns属性
返回一个Columns集合,代表表格中的所有列。只读。
有关返回集合中单个元素的详细信息,请参阅返回集合中的对象。
VBA示例
本示例显示活动演示文稿内第一个表格中的形状编号、幻灯片编号以及列数。
Dim ColCount As Integer
Dim sl As Integer
Dim sh As Integer
With ActivePresentation
    For sl = 1 To .Slides.Count
        For sh = 1 To .Slides(sl).Shapes.Count
            If .Slides(sl).Shapes(sh).HasTable Then
                ColCount = .Slides(sl).Shapes(sh) _
                    .Table.Columns.Count
                MsgBox "Shape " & sh & " on slide " & sl & _
                    " contains the first table and has " & _
                    ColCount & " columns."
                Exit Sub
            End If
        Next
    Next
End With
本示例检测选定的形状以查看其是否包含表格。如果包含表格,则此代码将设置第一列的列宽为 72 磅(一英寸)。
With ActiveWindow.Selection.ShapeRange
    If .HasTable = True Then
       .Table.Columns(1).Width = 72
    End If
End With

TA的精华主题

TA的得分主题

 楼主| 发表于 2015-12-30 09:02 | 显示全部楼层
COMAddIns属性
返回到对 Microsoft PowerPoint 中当前载入的组件对象模型 (COM) 加载项的调用。这些加载项列在“COM 加载项”对话框中。可以使用“自定义”对话框向“工具”菜单中添加“COM 加载项”命令。只读。
有关返回集合中单个元素的详细信息,请参阅返回集合中的对象。
CommandBars属性
应用于 Application对象的 CommandBars属性。
返回 PowerPoint 中代表所有命令栏的 CommandBars集合。只读。
应用于 Presentation对象的 CommandBars属性。
返回代表在主机容器应用程序和 PowerPoint 中合并命令栏集的 CommandBars集合。仅当容器是 DocObject 服务器(如 Microsoft 活页夹)并且 PowerPoint 作为 OLE 服务器时,此属性返回有效对象。只读。
有关返回集合中单个元素的详细信息,请参阅返回集合中的对象。
VBA示例
应用于 Application对象。
本示例放大所有的工具栏按钮并启用工具提示。
With Application.CommandBars
    .LargeButtons = True
    .DisplayTooltips = True
End With
应用于 Presentation对象。
本示例在应用程序窗口的顶部显示具有合并命令栏集的“格式”命令栏。
With ActivePresentation.CommandBars("Formatting")
    .Visible = True
    .Position = msoBarTop
End With
Comments属性
返回Comments对象,该对象代表批注的集合。
expression.Comments
expression  必选。该表达式返回“应用于”列表中的对象之一。
VBA示例
以下示例在幻灯片中添加一个批注。
Sub AddNewComment()
    ActivePresentation.Slides(1).Comments.Add _
        Left:=0, Top:=0, Author:="John Doe", AuthorInitials:="jd", _
        Text:="Please check this spelling again before the next draft."
End Sub
ConnectionSiteCount属性
返回指定形状中的连接部位的数量。只读。Long 类型。
VBA示例
本示例向myDocument 中添加两个矩形,并且用两个连接符连接这两个矩形。两个连接符的起始点都连到第一个矩形上的第一个连接部位;连接符的终止点分别连到第二个矩形上的第一个和最后一个连接部位上。
Set myDocument = ActivePresentation.Slides(1)
Set s = myDocument.Shapes
Set firstRect = s.AddShape(msoShapeRectangle, 100, 50, 200, 100)
Set secondRect = s.AddShape(msoShapeRectangle, 300, 300, 200, 100)
lastsite = secondRect.ConnectionSiteCount
With s.AddConnector(msoConnectorCurve, 0, 0, 100, 100) _
        .ConnectorFormat
    .BeginConnect ConnectedShape:=firstRect, ConnectionSite:=1
    .EndConnect ConnectedShape:=secondRect, ConnectionSite:=1
End With
With s.AddConnector(msoConnectorCurve, 0, 0, 100, 100) _
        .ConnectorFormat
    .BeginConnect ConnectedShape:=firstRect, ConnectionSite:=1
    .EndConnect ConnectedShape:=secondRect, _
        ConnectionSite:=lastsite
End With

TA的精华主题

TA的得分主题

 楼主| 发表于 2015-12-30 09:03 | 显示全部楼层
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用  · 内置多项VBA编程加强工具       ★ 免费下载 ★      ★使用手册
Connector属性
决定指定的形状是否为连接符。只读。MsoTriState 类型。
MsoTriState 可以是下列 MsoTriState 类型常数之一。
msoCTrue
msoFalse
msoTriStateMixed
msoTriStateToggle
msoTrue 指定的形状是连接符。
VBA示例
本示例删除了myDocument 中所有的连接符。
Set myDocument = ActivePresentation.Slides(1)
With myDocument.Shapes
    For i = .Count To 1 Step -1
        With .Item(i)
            If .Connector Then .Delete
        End With
    Next
End With
ConnectorFormat属性
返回一个包含连接符格式属性的ConnectorFormat对象。应用于代表连接符的 Shape 或 ShapeRange对象。只读。
VBA示例
本示例向myDocument 中添加两个矩形,用一个连接符连接这两个矩形,并自动将连接符路径修改为最短路径,然后断开矩形间的连接符。
Set myDocument = ActivePresentation.Slides(1)
Set s = myDocument.Shapes
Set firstRect = s.AddShape(msoShapeRectangle, 100, 50, 200, 100)
Set secondRect = s.AddShape(msoShapeRectangle, 300, 300, 200, 100)
With s.AddConnector(msoConnectorCurve, 0, 0, 0, 0).ConnectorFormat
    .BeginConnect firstRect, 1
    .EndConnect secondRect, 1
    .Parent.RerouteConnections
    .BeginDisconnect
    .EndDisconnect
End With
Container属性
返回一个包含指定嵌入演示文稿的对象。只读。Object 类型。
注意  如果容器不支持 OLE 自动化,或指定演示文稿不是嵌入在“Microsoft 活页夹”文件中,则本属性无效。
VBA示例
本示例将隐藏包含嵌入活动演示文稿的“Microsoft 活页夹”文件的第二部分。演示文稿的 Container属性将返回一个 Section对象,该 Section对象的 Parent属性将返回一个 Binder对象。
Application.ActivePresentation.Container.Parent.Sections(2) _
    .Visible = False
Contrast属性
返回或设置指定图片或 OLE对象的对比度。该属性的值必须是 0.0(最低对比度)到 1.0(最高对比度)的数。可读写。Single 类型。
VBA示例
本示例设置了myDocument 中第一个形状的对比度。第一个形状必须是图片或 OLE对象。
Set myDocument = ActivePresentation.Slides(1)
myDocument.Shapes(1).PictureFormat.Contrast = 0.8
Count属性
返回指定集合中的对象编号。
下列对象的只读 Integer 类型:Adjustments、CanvasShapes、DiagramNodeChildren、DiagramNodes、GroupShapes、ShapeNodes 和 Shapes。
下列对象的只读 Long 类型:ActionSettings、AddIns、AnimationPoints、Animations10、Borders、CellRange、ColorScheme、ColorSchemes、Columns、Comments、Designs、DocumentWindows、ExtraColors、Fonts、Hyperlinks、NamedSlideShow、NamedSlideShows、ObjectVerbs、Panes、Placeholders、Presentations、PrintRanges、PublishObjects、Rows、RulerLevels、ShapeRange、SlideRange、Slides、SlideShowWindows、TabStops、Tags、TextRange、TextStyleLevels、TextStyles、TimeNodes 和 Triggers。
VBA示例
本示例关闭除当前窗口外的所有窗口。
With Application.Windows
    For i = 2 To .Count
        .Item(2).Close
    Next
End With

TA的精华主题

TA的得分主题

 楼主| 发表于 2015-12-30 09:04 | 显示全部楼层
Creator属性
返回 Long 类型值,该值代表创建指定对象的应用程序创建者代码,该代码由四个字符构成。例如,如果对象是在 PowerPoint 中创建的,则此属性返回一个十六进制数 50575054。只读。
expression.Creator
expression 必选。该表达式返回“应用于”列表中的对象之一。
说明
Creator属性用于 Macintosh 下的 Microsoft Office 应用程序。
VBA示例
本示例显示一条有关 myObject对象创建者的消息。
Set myObject = Application.ActivePresentation.Slides(1).Shapes(1)
If myObject.Creator = &h50575054 Then
    MsgBox "This is a PowerPoint object"
Else
    MsgBox "This is not a PowerPoint object"
End If
CropBottom属性
返回或设置从指定图片或 OLE对象的底部所裁剪下的磅数。可读写。Single 类型。
注意  裁剪以其相对于图片初始大小来计算。例如,如果插入一个原为 100 磅高的图片,并将其高度改变为 200 磅,然后将 CropBottom属性设为 50,则将会从图片底部裁减掉 100 磅(而不是 50 磅)。
VBA示例
本示例在myDocument 中第三个形状的底部裁剪了 20 磅。要使本示例执行,第三个形状必须是图片或 OLE对象。
Set myDocument = ActivePresentation.Slides(1)
myDocument.Shapes(3).PictureFormat.CropBottom = 20
本示例从选定的形状底部裁减掉用户指定的比例,不管该形状是否被改变过比例。要使本示例执行,选定的形状必须是图片或 OLE对象。
percentToCrop = InputBox("What percentage do you " & _
    "want to crop off the bottom of this picture?")
Set shapeToCrop = ActiveWindow.Selection.ShapeRange(1)
With shapeToCrop.Duplicate
    .ScaleHeight 1, True
    origHeight = .Height
    .Delete
End With
cropPoints = origHeight * percentToCrop / 100
shapeToCrop.PictureFormat.CropBottom = cropPoints
CropLeft属性
返回或设置从指定图片或 OLE对象的左边所裁剪下的磅数。可读写。Single 类型。
注意  裁剪以其相对于图片初始大小来计算。例如,如果插入一个原为 100 磅宽的图片,并将其宽度改变为 200 磅,然后将 CropLeft属性设为 50,则将从图片左边裁减掉 100 磅(而不是 50 磅)。
VBA示例
本示例在myDocument 中第三个形状的左侧裁剪了 20 磅。要使本示例执行,第三个形状必须是图片或 OLE对象。
Set myDocument = ActivePresentation.Slides(1)
myDocument.Shapes(3).PictureFormat.CropLeft = 20
本示例从选定的形状左边裁减掉用户指定的比例,不管该形状是否被改变过比例。要使本示例执行,选定的形状必须是图片或 OLE对象。
percentToCrop = InputBox("What percentage do you " & _
    "want to crop off the left of this picture?")
Set shapeToCrop = ActiveWindow.Selection.ShapeRange(1)
With shapeToCrop.Duplicate
    .ScaleWidth 1, True
    .Width = origWidth
    .Delete
End With
cropPoints = origWidth * percentToCrop / 100
shapeToCrop.PictureFormat.CropLeft = cropPoints
您需要登录后才可以回帖 登录 | 免费注册

本版积分规则

手机版|关于我们|联系我们|ExcelHome

GMT+8, 2024-9-28 11:23 , Processed in 0.052342 second(s), 4 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 1999-2023 Wooffice Inc.

沪公网安备 31011702000001号 沪ICP备11019229号-2

本论坛言论纯属发表者个人意见,任何违反国家相关法律的言论,本站将协助国家相关部门追究发言者责任!     本站特聘法律顾问:李志群律师

快速回复 返回顶部 返回列表