OberonPlace.com Forums  

Go Back   OberonPlace.com Forums > Developer Forums > VBA > CorelDRAW/Corel DESIGNER VBA

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 28-08-2012, 16:56
platesigns platesigns is offline
Junior Member
 
Join Date: Aug 2012
Posts: 2
Default Editing text & tab in corel draw

Hi

Can someone help with step 5 and 6 below ?

Thanks





STEP 1: COPY SELECTION FROM EXCEL
STEP2 : RUN PASTE SPECIAL MACRO
STEP 3: RUN THE CONVERT TEXT MACRO
STEP4: RUN THE FONT CHANGE MACRO
WITH LINE SPACING
STEP5: ON LINE ONE, CAN WE USE A MACRO
TO PLACE THE CURSOR AT THE SECOND LETTER
PRECEDING THE FIRST NUMBER AND HENCE CREATE
A NEW LINE
STEP6: FOR EVERY LINE THAT FOLLOWS AFTER STEP 5,
AFTER THE FIRST 3 LETTERS, THE MUST BE 3 POINT SPACE
UNLESS ITS AN i IN WHICH CASE IT MUST BE 4 SPACES

*****after paste special in corel draw******

CANE WEIGHBRIDGEK1-01-03-100
-ELEELECTRICAL CONTROLS AND CABLES
-INSINSTRUMENTATION
-SU1STRUCTURE

*******this is the final result i want to end up with **********

CANE WEIGHBRIDGE
K1-01-03-100
-ELE ELECTRICAL CONTROLS AND CABLES
-INS INSTRUMENTATION
-SU1 STRUCTURE

****codes for some of the steps above******************
Reply With Quote
  #2  
Old 09-09-2012, 18:40
shelbym's Avatar
shelbym shelbym is offline
Senior Member
 
Join Date: Nov 2002
Location: Cheyenne, WY
Posts: 1,788
Blog Entries: 12
Send a message via ICQ to shelbym Send a message via AIM to shelbym Send a message via MSN to shelbym Send a message via Yahoo to shelbym
Default Editing Text

Alright, here is my solution. I have only tested this in CorelDRAW X6, and I wasn't 100% sure about the i character as your example doesn't provide this sample.
Code:
Sub ModifyText()
    Dim s As Shape
    Dim strOrigText As String
    Dim iNumPos As Integer
    Dim tr As TextRange
    
    Set s = ActiveShape
    
    strOrigText = s.Text.Story.Lines.First
    iNumPos = GetFisrtNumericPosition(strOrigText)
    strOrigText = Left(strOrigText, iNumPos - 2) & Chr(13) & Right(strOrigText, Len(strOrigText) - iNumPos + 2)
    s.Text.Story.Lines.First = strOrigText
        
    For i = 3 To s.Text.Story.Lines.Count
        Set tr = s.Text.Story.Lines.Item(i)
        If tr.Characters.Item(4) = "i" Then
            tr = Left(tr, 5) & " " & Right(tr, tr.Characters.Count - 5)
        Else
            tr = Left(tr, 4) & " " & Right(tr, tr.Characters.Count - 4)
        End If
    Next i
End Sub

Public Function GetFisrtNumericPosition(ByVal s As String) As Integer
    For i = 1 To Len(s)
        If IsNumeric(Mid(s, i, 1)) Then
            GetFisrtNumericPosition = i
            Exit Function
        End If
    Next i
End Function
If you need a change or two to get it working the way you need, please let me know.

-Shelby
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Send text from external program to Corel Draw nategregory CorelDRAW/Corel DESIGNER VBA 2 07-08-2012 20:38
Center a text vertically in VBA Corel Draw JFJ Macros/Add-ons 2 22-03-2011 18:12
Using A Macro while editing text. knowbodynow CorelDRAW/Corel DESIGNER VBA 6 23-05-2008 01:03
Corel Trace and editing in Corel draw madhur General 1 26-09-2007 18:04
Draw x3 problems - bitmap editing & eyedropper siegbrunn General 3 15-11-2006 14:25


All times are GMT -5. The time now is 01:14.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.
Copyright © 2011, Oberonplace.com