NOVOTS KMS 词汇表 Glossary    联系我们 Contact Us
查询 Search  
按类别浏览 Browse by Category
NOVOTS KMS .: 办公软件 .: 以编程方式使用Office 2010中的VBA创建视频

以编程方式使用Office 2010中的VBA创建视频

此示例演示如何以编程方式使用Microsoft Office 2010中的Microsoft Visual Basic for ApplicationsVBA)创建视频。

此代码段是Office 2010101VBA代码示例中的一部分。与其它示例一样,这些将可以直接写入您的代码中。

每块示例代码包含约550行的代码,分别演示了一个独特的功能或功能集,在VBAVB以及C#中(在Visual Studio 2010中创建)。每个示例之中都会包含代码以及相应注释,这样您就可以直接运行获取预期的结果,或者是根据代码注释提示来调整环境,运行示例代码。

Microsoft Office 2010提供了你所需要的工具来创建功能强大的应用程序。Microsoft Visual Basic ApplicationVBA)代码示例可以帮助你创建自己的应用程序,以执行特定功能或者以此为出发点实现更为复杂的功能。


将此代码放在PowerPoint 2010演示文稿一个模块内并测试运行。

' PowerPoint 2010

' Place this code in a module within a PowerPoint 2010 presentation,

' and run the following test procedure. Modify the output file name

' as necessary:

Sub TestCreateSampleVideo()

CreateSampleVideo ActivePresentation, "C:\Temp\Video.wmv"

End Sub

Sub CreateSampleVideo(pres As Presentation, fileName As String)

' Presentation.CreateVideo does its work asynchronously.

' You can use the Presentation.CreateVideoStatus property

' to periodically check the status, and react accordingly.

' Besides the file name, the CreateVideo method accepts the following

' parameters:

' UseTimingsAndNarration indicates whether to use the presentation's

' timings and narrations that you have supplied. If false, the

' conversion disregards this information. The default is True.

' DefaultSlideDuration indicates the default timing for each slide,

' if you have haven't specified a timing or if you set

' UseTimingsAndNarration to false. The default value is 5 seconds.

' VertResolution indicates the vertical resolution for your movie. The

' default is 720. Regular options include 720, 480, and 240, although you

' can specify any reasonable value you like (200 would work, for example,

' although it's not a standard vertical resolution.)

' FramesPerSecond indicates the number of frames per second in the

' output video. The default value is 30, and unless you have a reason

' to change this, leave it alone.

' Quality indicates a relative quality of the video, and the default

' value is 85. The larger the number, the larger the output and the longer

' it takes to create the video. Unless you have a reason, leave this

' at the default value. Try setting the value to a low number: You'll see

' a definite degradation in output quality.

pres.CreateVideo fileName, DefaultSlideDuration:=1, VertResolution:=480

' Now wait for the conversion to be complete:


' Don't tie up the user interface, add DoEvents

' to give the mouse and keyboard time to keep up.


Select Case pres.CreateVideoStatus

Case PpMediaTaskStatus.ppMediaTaskStatusDone

MsgBox "Conversion complete!"

Exit Do

Case PpMediaTaskStatus.ppMediaTaskStatusFailed

MsgBox "Conversion failed!"

Exit Do

Case PpMediaTaskStatus.ppMediaTaskStatusInProgress

Debug.Print "Conversion in progress"

Case PpMediaTaskStatus.ppMediaTaskStatusNone

' This shouldn't happen--you'll get this value

' when you ask for the status and no conversion

' is happening or has completed.

Case PpMediaTaskStatus.ppMediaTaskStatusQueued

Debug.Print "Conversion queued"

End Select


End Sub



article 以编程方式使用Office_2010中的VBA创建视频

(No rating)  9-12-2013    Views: 586   
article 以编程方式使用Office_2010中的VBA创建视频

(No rating)  9-12-2013    Views: 580   
article 使用Office 2007创建Novstyle时报错

  7-2-2010    Views: 1357   



.: .: .: .: .:
[ 登陆 ]
北京护航科技有限公司 2006

Novots Technologies Limited