How To Run VSTA Macros

I have created a VSTA Macro using the VSTA Editor.
How do I run it from CorelDRAW?
The Only macros visible in Macro Manager are VBA macros

  • Answer:  CorelDRAW does not support "macros" in VSTA yet, as VBA does.  At present, VSTA is limited to add-ins only.

    Create your  VSTA add-in (a .Net assembly, written in VB or C#) using the VSTA IDE (Tools | Macros | VSTA Editor).   

    Build, debug, then copy your add-in .dll

    from:  C:\Users\<username>\Documents\Corel\VSTA\CorelDRAW\Projects\<add-in name>\<add-in name>\bin\Release folder

     to:  C:\Users\<username>\Documents\Corel\VSTA\CorelDRAW\Addins folder

    CorelDRAW will load your add-in at startup, executing the code in your add-in's 'Class Main', 'Private Sub Main_Startup(...)' as following VB example: 

    Imports Corel.Interop.CorelDRAW

    Partial Class Main

    Private Sub Main_Startup(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Startup

    app = CType(Me.Host, Application)


    End Sub

    Public Sub FillRectOnDoc()

    Dim rect1 As Shape


    rect1 = app.ActiveLayer.CreateRectangle(1.860965, 8.202012, 6.805957, 3.549126)

    rect1.Rectangle.CornerType = cdrCornerType.cdrCornerTypeRound

    rect1.Rectangle.RelativeCornerScaling = True


    rect1.Fill.UniformColor.CMYKAssign(0, 100, 56, 0)

    End Sub

    End Class









Reply Children
No Data