How to install icon on standard bar to run macro by VBA

How to install icon on standard bar to run macro by VBA

  • How to install icon on standard bar to run macro by VBA

    A macro sub can be used like other Commands in CorelDRAW's workspace customization.

    You might look at this blog post: #2: Workspace Customization - Using a VBA macro sub as a Command.

    In that example, I dragged the command to a custom toolbar, but the same type of drag-and-drop can be used to add it to other toolbars or menus.

    • Not manually
      With VBA codes

      • In X7 it can be done by VBA but not in 2022

        • Oh, sorry! I misunderstood your question.

          • Is there any way

            • I don't have any experience with using VBA to modify the CorelDRAW workspace.

              • I am from India .

                You are from which country.

                This is how i do in X7 

                Private Sub GlobalMacroStorage_Start()

                Dim n
                n = GetSetting("CorelDRAW", "macrosX7", MACRONAME & "Installed")
                If n = "" Or  n = 0 Then
                     Call Install
                Else
                     Exit Sub
                End If
                End Sub

                Private Sub Install()
                With FrameWork.CommandBars("Standard").Controls.AddCustomButton _
                ("2cc24a3e-fe24-4708-9a74-9c75406eebcd", "PrePress_V4_Chandan.aPrePress4_C.main", 70, False)
                .SetCustomIcon GMSManager.UserGMSPath & "prepress.bmp"
                .ToolTipText = "Prepress Chandan"
                .DescriptionText = "Macros"
                .Caption = "PrePress"
                End With
                SaveSetting "CorelDRAW", "macrosX7", MACRONAME & "Installed", "1"

                End Sub

                Private Sub DeleteGMS()
                Dim path$: path = GMSManager.UserGMSPath & "IconInstallerCarton.gms"
                Dim file$: file = FileSystem.Dir(path)
                If file <> "" Then FileSystem.Kill path
                End Sub

                There is a way of doing in 2018 to 2023 by corelDraw Addon