CorelDraw

Change All Arrows to one Standard Arrow

Ease of Use

Easy

Version tested with

2005 (X3) 

Submitted by:

malik641

Description:

This will take all the arrows in the ActiveDocument on the ActivePage and make them into a single standard arrow. 

Discussion:

Say you have engineering drawings in CorelDraw and it contains arrows. Now it has been revised a few times since its creation. If the user who makes the revisions adds some arrows, chances are they are different. There are many arrows in CorelDraw, and some of them differ subtly. This macro insures that all arrows used will be exactly the same. This is great if you want consistency in your arrow types. 

Code:

instructions for use

			

Option Explicit Public Sub Arrow_Convert() ' This will make sure all the arrows in the drawings are the same ' Preliminary check before running the procedure If Documents.Count < 1 Then Exit Sub Application.Optimization = True Dim shp As CorelDRAW.Shape Const ArrowType As Integer = 3 ' Standard arrow to use ' Select all the items on the page ActivePage.Shapes.All.CreateSelection ' Iterate through all the shapes in the drawing For Each shp In ActiveDocument.Selection.Shapes ' Check if the shape can be converted to a curve If shp.Outline.Type = cdrOutline Then ' Check and change arrows (Start and End) as necessary If shp.Outline.StartArrow.Index <> 0 Then shp.Outline.StartArrow = ArrowHeads.Item(ArrowType) End If If shp.Outline.EndArrow.Index <> 0 Then shp.Outline.EndArrow = ArrowHeads.Item(ArrowType) End If ' Can also be referenced as shp.Outline.StartArrow = ArrowHeads (5) End If Next shp ' Clear the selection we had ActiveDocument.ClearSelection Application.Optimization = False ActiveWindow.Refresh End Sub

How to use:

  1. When in CorelDraw, Press Alt+F11. This will take you into the VBE
  2. In the VBE, select your GMS (global macro storage) project OR the CorelDraw document in the Project Window, click Insert --> Module
  3. Copy the above code and paste into the new Module
  4. Close the VBE
  5. In CorelDraw, press Tools --> Visual Basic... --> Play... --> Arrow_Convert
 

Test the code:

  1. In CorelDraw, press Tools --> Visual Basic... --> Play... --> Arrow_Convert
 

Sample File:

Arrow_Convert Example.zip 9.5KB 

Approved by mdmackillop


This entry has been viewed 46 times.

Please read our Legal Information and Privacy Policy
Copyright @2004 - 2020 VBA Express