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 19-07-2010, 06:35
olympiatr
Guest
 
Posts: n/a
Default how to find and remove duplicate entries in Listboxes?

hi all again,

tryin to write a macro likely printmerge etc. now i stopped a point )) actually i can do it in VB6 but here in VBA can not succes over it. my problem is; how can i find and remove duplicate entries in listboxes? (i am gettin datas from excel sheet and listin them to two listboxes cause from excel data they comin sometimes duplicated.) finally i am close to finish and i think gonna be good work ) (apart of corel print merge, it works with images.) regards to all.
Reply With Quote
  #2  
Old 20-07-2010, 02:10
SteveDude SteveDude is offline
Senior Member
 
Join Date: Dec 2005
Location: Salina, Kansas USA
Posts: 149
Default ...

Bunch of ways in VB6 to do it, many use two listboxes or arrays. Just think of if the listbox as and array an treat it that way in VBA.
Reply With Quote
  #3  
Old 20-07-2010, 13:10
olympiatr
Guest
 
Posts: n/a
Default sure

yeah, sure i tried them all, for ex: hwnd function doesn't work over it ))) i just asked if someone has better way around it. btw thnx much for your response.
Reply With Quote
  #4  
Old 20-07-2010, 13:43
runflacruiser's Avatar
runflacruiser runflacruiser is offline
Senior Member
 
Join Date: Jun 2009
Location: Pigeon Forge, TN USA
Posts: 811
Default

Hi.
I think this is what Steve was referring to:

Something like this.

Code:
Sub UniqueList()
Dim i As Long
Dim arr As Variant
Dim Unique As New Collection

arr = Sheet1.Range("input")

For i = 1 To UBound(arr, 1)
    On Error Resume Next
    cUnique.Add arr(i, 1), CStr(arr(i, 1))
Next row

ReDim arr(1 To Unique.Count, 1 To 1)
For i = 1 To Unique.Count
    arr(i, 1) = cUnique(i)
Next row
Sheet1.Range("output").Resize(UBound(arr, 1), 1).Value = arr

End Sub
-John
Reply With Quote
  #5  
Old 20-07-2010, 14:11
olympiatr
Guest
 
Posts: n/a
Default thnx friend

thnx dear friend. infact first sight, i mean about it, when i got data already (excel, access etc, dunn matter), over form between two listboxes so ur codes givin me clue either... again, thnx much...

Last edited by olympiatr; 20-07-2010 at 14:14. Reason: mistype...
Reply With Quote
  #6  
Old 26-07-2010, 19:03
runflacruiser's Avatar
runflacruiser runflacruiser is offline
Senior Member
 
Join Date: Jun 2009
Location: Pigeon Forge, TN USA
Posts: 811
Default

Hi.
I needed this same function today.
Hopefully you can adapt or use my code to help.

It is a simple sub that adds shapes text.character.all string to a list box as long as there is not already one with the same name there.

Code:
Public Sub createLstBox(Optional nada As Boolean)
    saveSetSTC
    Dim s As Shape, sr As ShapeRange
    Dim c As Long, lItem As Long
    Dim dupBool As Boolean
    
    Set sr = ActiveSelectionRange
    If sr.Count = 0 Then Exit Sub
    
    On Error Resume Next 'for text in shapes!!
    
    c = 1
    For c = 1 To sr.Count
        If sr(c).Text.Story.Characters.Count > 0 Then
            If lst1.ListCount = 0 Then
                lst1.AddItem Trim(sr(c).Text.Story.Characters.All)
            Else
                dupBool = False
                For lItem = 0 To lst1.ListCount - 1
                    If Trim(sr(c).Text.Story.Characters.All) = Trim(CStr(lst1.List(lItem))) Then
                       dupBool = True
                    End If
                Next
                If Not dupBool Then lst1.AddItem Trim(sr(c).Text.Story.Characters.All)
            End If
        End If
    Next c

End Sub
-John

Last edited by runflacruiser; 26-07-2010 at 19:43. Reason: spelling fix
Reply With Quote
  #7  
Old 26-07-2010, 20:29
olympiatr
Guest
 
Posts: n/a
Default thnx, thats it! ;)

yeah, thnx dear friend. thats it indeed. when project has finished, i'll be appreciate you )) thnx again.
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
Question re: CW Remove Overlap/Intersections ajohnsonlaird CurveWorks 4 30-06-2014 10:06
Remove Paragraph marks from artistic text knowbodynow CorelDRAW/Corel DESIGNER VBA 2 31-03-2006 19:48
How to remove extra nodes from a curve Alex FAQ 1 23-01-2006 10:37
Sorting entries in the object manager dan CorelDRAW/Corel DESIGNER VBA 1 18-08-2004 23:16
How to remove it? Anonymous CurveWorks 2 30-12-2003 14:38


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


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