Object Model Reference : Classes : A : Application : Methods : Application.InitializeVBA |
Function InitializeVBA() As Boolean
Member of Application
The InitializeVBA method loads and initializes the Macro Editor.
This method is called from an automation controller such as Visual Basic (VB) or C++.
The following VBA example runs the specified VBA macro, CreatePuzzlePiece, from a VB project.
The first subroutine should be placed in a code module named TestModule. The second subroutine should be placed in the code of a form module of a standard EXE project in VB. There must be a command button on the form.
Public Sub CreatePuzzlePiece() |
Dim s As Shape, sp As SubPath, crv As Curve |
Dim i As Integer |
Optimization = True |
Set crv = Application.CreateCurve(ActiveDocument) |
Set sp = crv.CreateSubPath(1.351, 8.545) |
sp.AppendCurveSegment 1.351, 8.926, 0.127, 89.901, 0.127, -64.56 |
sp.AppendCurveSegment 1.156, 8.952, 0.066, 115.44, 0.066, -48.906 |
sp.AppendCurveSegment 1.156, 9.15, 0.065, 131.09, 0.065, -133.149 |
sp.AppendCurveSegment 1.351, 9.163, 0.065, 46.846, 0.065, -116.315 |
sp.AppendCurveSegment 1.351, 9.545, 0.127, 63.683, 0.127, -89.902 |
sp.AppendCurveSegment 0.976, 9.545, 0.125, 179.951, 0.125, 25.612 |
sp.AppendCurveSegment 0.96, 9.342, 0.063, -154.391, 0.063, 40.943 |
sp.AppendCurveSegment 0.767, 9.339, 0.067, -139.06, 0.067, -41.987 |
sp.AppendCurveSegment 0.752, 9.547, 0.063, 138.014, 0.065, -33.906 |
sp.AppendCurveSegment 0.351, 9.545, 0.134, 146.087, 0.134, 0.045 |
sp.AppendCurveSegment 0.351, 9.163, 0.127, -90#, 0.127, 63.681 |
sp.AppendCurveSegment 0.156, 9.15, 0.065, -116.317, 0.065, 46.846 |
sp.AppendCurveSegment 0.156, 8.952, 0.065, -133.152, 0.065, 131.093 |
sp.AppendCurveSegment 0.351, 8.926, 0.066, -48.906, 0.066, 115.439 |
sp.AppendCurveSegment 0.351, 8.545, 0.127, -64.561, 0.127, 90# |
sp.AppendCurveSegment 0.752, 8.547, 0.134, 0.002, 0.134, 146.087 |
sp.AppendCurveSegment 0.767, 8.339, 0.065, -33.908, 0.063, 138.012 |
sp.AppendCurveSegment 0.96, 8.342, 0.067, -41.987, 0.067, -139.058 |
sp.AppendCurveSegment 0.976, 8.545, 0.063, 40.943, 0.063, -154.388 |
sp.AppendCurveSegment 1.351, 8.545, 0.125, 25.613, 0.125, 179.998 |
sp.Closed = True |
Set s = ActiveLayer.CreateCurve(crv) |
Optimization = False |
ActiveWindow.Refresh |
Application.Refresh |
End Sub |
Private Sub Command1_Click() |
Dim cDraw As Object |
Dim gms As CorelDRAW.GMSManager |
Set cDraw = CreateObject("CorelDRAW.Application") |
cDraw.CreateDocument |
cDraw.InitializeVBA |
cDraw.Visible = True |
Set gms = cDraw.GMSManager |
gms.RunMacro "GlobalMacros", "TestModule.CreatePuzzlePiece" |
End Sub |
Copyright 2013 Corel Corporation. All rights reserved.