Hello, peopleI try to create DLL file with VSTA editor. I have Visual Studio 2019 installed, CorelDraw X5, Windows 10 Home 64 bitDLL file is ready, but can not start any sub from DLL fileI want to call sub from VBA Module and at top of module I have declarations:
Public Declare Sub FillRectOnDocA Lib "G:\ONEDRIVE\Documents\Corel\VSTA\CorelDRAW\Addins\AddIn2.dll" ()Public Declare Sub proba1 Lib "G:\ONEDRIVE\Documents\Corel\VSTA\CorelDRAW\Addins\AddIn2.dll" ()Public Declare Sub proba2 Lib "G:\ONEDRIVE\Documents\Corel\VSTA\CorelDRAW\Addins\AddIn2.dll" ()Then in same VBA module i have:
Sub just_created_macro()FillRectOnDocAEnd SubSub just_created_macro1()proba1End Sub
Sub just_created_macro2()proba2End Sub
In Main.vb of Addin2 project code:
<System.AddIn.AddIn("My Add-in", Version:="1.0", Publisher:="", Description:="")> _Partial Class Main WithEvents app As Application
Private Sub Main_Startup(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Startup app = CType(Me.Host, Application)
FillRectOnDocA() End Sub
Public Sub FillRectOnDocA()
Dim rect1 As Shape
app.CreateDocument()
rect1 = app.ActiveLayer.CreateRectangle(1.860965, 8.202012, 6.805957, 3.549126)
rect1.Rectangle.CornerType = cdrCornerType.cdrCornerTypeRound
rect1.Rectangle.RelativeCornerScaling = True
rect1.Fill.ApplyNoFill()
rect1.Fill.UniformColor.CMYKAssign(0, 100, 56, 0)
End SubEnd Class
The code above work well and at start of Corel creates Rectangle
But the other 2 codes don't work
Module Module1Sub proba1()MsgBox("OK1")End SubEnd ModulePublic Class Class1 Sub proba2() MsgBox("OK2") End SubEnd Class
When I start
Sub just_created_macro()FillRectOnDocAEnd Sub
OR
Sub just_created_macro1()proba1End Sub
Run-time error 453 appears
Please help to overcome this problem!
Greetings!
Did you find a solution?
No...