This sample illustrates how to export an ArcMap animation as an AVI video file.
How to use
- Open an ArcMap document;
- Create one or more animation tracks in ArcMap using the animation toolbar (any type of animation is good);
- Copy and paste the following code into the VB editor in ArcMap, and change the export path to your own path;
- Make sure that "ESRI Animation Object Library" and "ESRI AnimationUI Object Library" are checked in the References dialog box of the VBA project;
- Run the macro "Export_Animation_AVI";
- Verify that an AVI video file is created by playing it in your system’s video player.
Public Sub Export_Animation_AVI()
'Find the animation extension
Dim pUID As New UID
pUID.Value = "esriAnimation.AnimationExtension"
Dim pAnimExt As IAnimationExtension
Set pAnimExt = Application.FindExtensionByCLSID(pUID)
'Create an instance of videoexporter
Dim pVideoExporter As IVideoExporter
Set pVideoExporter = New AnimationExporterAVI
'Get statusbar from application
Dim pStatusBar As IStatusBar
Set pStatusBar = Application.StatusBar
pVideoExporter.ExportFileName = "C:\Temp\VideoExp.avi"
pVideoExporter.CodecCode = "CVID"
pAnimExt.AnimationEnvironment.AnimationDuration = 5#
pVideoExporter.ExportAnimation pAnimExt.AnimationTracks, pAnimExt.AnimationEnvironment, pStatusBar
End Sub