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 31-05-2008, 23:28
knowbodynow knowbodynow is offline
Senior Member
 
Join Date: Mar 2006
Location: Hatsukaichi near Hiroshima
Posts: 434
Default Removing lines of text

Hello I have some paragraph text. How can I compare each line of the paragraph text to each page name in a document and if the text matches any page name delete that line of text?

Thanks,

Chris (Hunt)
Reply With Quote
  #2  
Old 01-06-2008, 10:01
Alex's Avatar
Alex Alex is offline
Administrator
 
Join Date: Nov 2002
Posts: 1,940
Blog Entries: 4
Default

Here is how:

Code:
Sub DeletePageNames()
    Dim txt As TextRange
    Dim trPara As TextRange
    Dim i As Long
    Dim p As Page
    Dim lookUpList As String
    
    Set txt = ActiveShape.Text.Story
    
    ' Create a Carriage-Return separated list of page names
    For Each p In ActiveDocument.Pages
        If p.Name <> "" Then lookUpList = lookUpList & p.Name & vbCr
    Next p
    
    ' Go through paragraphs in the text object and see if they have any page names
    For i = txt.Paragraphs.Count To 1 Step -1
        Set trPara = txt.Paragraphs(i)
        If InStr(lookUpList, trPara.Text) <> 0 Then
            ' Paragraph has one of the page names
            ' Delete it
            trPara.Delete
        End If
    Next i
End Sub
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
Identifying specific lines of paragraph text knowbodynow CorelDRAW/Corel DESIGNER VBA 3 06-12-2007 02:58
leading (line spacing) between lines of artistic text that have different font size michael_maberly General 4 15-07-2007 11:07
Striping a word down to the first letter only knowbodynow CorelDRAW/Corel DESIGNER VBA 9 19-04-2007 15:14
Text selection and sizing ddonnahoe CorelDRAW/Corel DESIGNER VBA 5 17-05-2005 13:19
Reset text after text compression. Bellekom CorelDRAW/Corel DESIGNER VBA 2 05-05-2004 06:14


All times are GMT -5. The time now is 15:22.


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