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 23-07-2006, 15:21
Shaddy
Guest
 
Posts: n/a
Default Fill Combo Box

I came up with some code, but I doubt it's the most efficient, do you mind taking a look and telling me how you'd do it?

I want to fill a combo box on a user form (cboName) with all the names of the objects on the page. My difficulty was making sure I didn't use the same name twice. I tried using a collection first, but I didn't figure it out so I went back to an Array to do it.

Like I said it works, but I'd like some input to make it prettier and more efficient.

Code:
Sub FillList()
  Dim s As Shape, sr As ShapeRange, vName As String, vNameAry() As Variant, vTemp, i As Integer, vFound As Boolean
  Dim j As Integer
  Set sr = ActivePage.FindShapes
  If sr.Count = 0 Then
    MsgBox "No objects on page.  Only run this when there are objects to rename/select."
    Unload Me
    End
  End If
  ReDim vNameAry(sr.Count)
  j = 1
  For Each s In sr
    vName = s.ObjectData("Name").Value
    vFound = False
    For i = 1 To j
      If vName = vNameAry(i) Then
        vFound = True
        Exit For
      End If
    Next i
    If vName <> "" And Not vFound Then
      vNameAry(j) = vName
      j = j + 1
      cboName.AddItem vName
    End If
  Next s
End Sub
Shaddy
Reply With Quote
  #2  
Old 25-07-2006, 09:10
Lev
Guest
 
Posts: n/a
Default

see thread shape-names in listbox
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
Populate an Array and stick the results in a Combo Box akayani CorelDRAW/Corel DESIGNER VBA 2 23-03-2006 19:56
Checking fill type knowbodynow CorelDRAW/Corel DESIGNER VBA 2 08-03-2006 02:18
Fountain Fill changes when object is rotated Alex FAQ 1 03-05-2005 22:35
Need help connecting to database and filling combo box CamWest CorelDRAW/Corel DESIGNER VBA 6 22-12-2004 13:30
Try to capture a fill color for reuse Anonymous CorelDRAW CS 1 03-05-2004 20:48


All times are GMT -5. The time now is 02:00.


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