Notification texts go here Contact Us Buy Now!

MultipleCopyCurveLengthToText_VBA_Coreldraw

KHTM
MultipleCopyCurveLengthToText

Option Explicit

Sub MultipleCopyCurveLengthToText()

    Dim sr As ShapeRange
    Dim s As Shape
    Dim t As Shape
    Dim lengthVal As Double

    If ActiveSelectionRange.Count = 0 Then
        MsgBox "Please select one or more objects.", vbExclamation
        Exit Sub
    End If

    Set sr = ActiveSelectionRange

    Dim i As Long

    For i = 1 To sr.Count

        Set s = sr(i)

        'Convert to Curve if necessary
        If s.Type <> cdrCurveShape Then
            s.ConvertToCurves
        End If

        If s.Type = cdrCurveShape Then

            'Curve Length (cm)
            lengthVal = s.Curve.Length * 2.54

            'Create Text
            Set t = ActiveLayer.CreateArtisticText(0, 0, _
                Format(lengthVal, "0.0000") & " cm")

            'Move text to object center
            t.centerX = s.centerX
            t.centerY = s.bottomY - 0.5

'            t.Fill.UniformColor.RGBAssign 255, 0, 0

        End If

    Next i

End Sub


Post a Comment

Cookie Consent
We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.
Oops!
It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.
AdBlock Detected!
We have detected that you are using adblocking plugin in your browser.
The revenue we earn by the advertisements is used to manage this website, we request you to whitelist our website in your adblocking plugin.
Site is Blocked
Sorry! This site is not available in your country.
/* Calculate Coil Length-Meter */ /* Calculate Coil Length-Meter-function */