Some PowerPoint VBA Tips

1) To insert slides from another presentation file, use InsertFromFile Method:
Inserts slides from a file into a presentation, at the specified location. Returns an integer that represents the number of slides inserted.
expression.InsertFromFile(FileName, Index, SlideStart, SlideEnd)
expression - Required. An expression that returns a Slides collection.
FileName - Required String. The name of the file that contains the slides you want to insert.
Index - Required Long. The index number of the Slide object in the specified Slides collection you want to insert the new slides after.
SlideStart - Optional Long. The index number of the first Slide object in the Slides collection in the file denoted by FileName.
SlideEnd - Optional Long. The index number of the last Slide object in the Slides collection in the file denoted by FileName.
Example
This example inserts slides three through six from C:/Ppt/Sales.ppt after slide two in the active presentation.
ActivePresentation.Slides.InsertFromFile _
    "c:/ppt/sales.ppt", 2, 3, 6
 
2) To get snapshot of a slide, use ActivePresentation.SaveAs FileName:="c:/filename.png", FileFormat:=ppSaveAsPNG, EmbedTrueTypeFonts:=msoFalse
 
3) Some other useful VBA code snippets on web:
 
pptvba的属性,类,方法 1.Application对象 该对象代表PowerPoint应用程序,通过该对象可访问PowerPoint中的其他所有对象。 (1)Active属性:返回指定窗格是否被激活。 (2)ActivePresentation属性:返回Presentation对象,代表活动窗口中打开的演示文稿。 (3)ActiveWindow属性:返回DocumentWindow对象,代表当前文档窗口。 (4)Presentations属性:返回Presentations集合,代表所有打开的演示文稿。 (5)SlideShowWindows属性:返回 SlideShowWindows集合,代表所有打开的幻灯片放映窗口。 (6)Quit方法:用于退出PowerPoint程序。 2.DocumentWindow对象 该对象代表文档窗口。使用“Windows(index) ”语法可返回DocumentWindow对象。 (1)ActivePane属性:返回Pane对象,代表文档窗口中的活动窗格。 (2)Panes属性:返回Panes集合,代表文档窗口中的所有窗格。 (3)ViewType属性:返回指定的文档窗口内的视图类型。[NextPage] 3.Presentation对象 该对象代表演示文稿,通过“Presentations(index)”语法可返回Presentation对象。 (1)BuiltInDocumentProperties属性:返回DocumentProperties集合,代表演示文稿的所有文档属性。 (2)ColorSchemes属性:返回ColorSchemes 集合,代表演示文稿的配色方案。 (3)PageSetup属性:返回PageSetup对象,用于控制演示文稿的幻灯片页面设置属性。 (4)SlideMaster属性:返回幻灯片母版对象。 (5)SlideShowSettings属性:返回SlideShowSettings对象,代表演示文稿的幻灯片放映设置。 (6)SlideShowWindow属性:返回幻灯片放映窗口对象。 (7)AddTitleMaster方法:为演示文稿添加标题母版。 (8)ApplyTemplate方法:对演示文稿应用设计模板。 4.SlideShowWindow对象 该对象代表幻灯片放映窗口。 IsFullScreen属性:用于设置是否全屏显示幻灯片放映窗口。[NextPage] 5.Master对象 该对象代表幻灯片母版、标题母版、讲义母版或备注母版。 TextStyles属性:为幻灯片母版返回TextStyles 集合,代表标题文本、正文文本和默认文本。 6.Slide对象 该对象代表幻灯片。 (1)SlideID属性:返回幻灯片的唯一标识符。 (2)SlideIndex属性:返回幻灯片在Slides集合中的索引号。 7.SlideShowView对象 该对象代表幻灯片放映窗口中的视图。 (1)AcceleratorsEnabled属性:用于设置是否允许在幻灯片放映时使用快捷键。 (2)CurrentShowPosition属性:返回当前幻灯片在放映中的位置。 (3)DrawLine方法:在指定幻灯片放映视图中绘制直线。 (4)EraseDrawing方法:用于清除通过DrawLine方法或绘图笔工具在放映中绘制的直线。 (5)GotoSlide方法:用于切换指定幻灯片。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值