Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / March 2008

Tip: Looking for answers? Try searching our database.

InlineShapes

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ambiga - 29 Feb 2008 11:32 GMT
Hi,

I want to know how to retrieve the list items of List Box and combo Box
controls available in Inlineshapes.

Thanks in advance.

-----
Ambiga
fumei - 29 Feb 2008 20:52 GMT
Loads up a Listbox and a Combobox

Sub LoadEmUp()
Dim whatever1()
Dim whatever2()
Dim var, var2
whatever1 = Array("LIST_item1", "LIST_item2", "LIST_item3")

whatever2 = Array("COMBO_item1", "COMBO_item2", _
  "COMBO_item3", "COMBO_item4", "COMBO_item5")
 
ListBox1.Clear
ComboBox1.Clear
For var = 0 To UBound(whatever1)
  ListBox1.AddItem whatever1(var)
Next

For var2 = 0 To UBound(whatever2)
  ComboBox1.AddItem whatever2(var2)
Next

ComboBox1.ListIndex = 0
End Sub

Gets the lists

Sub GetEm()
Dim msg As String
Dim myObject As Object
Dim objInline As InlineShape
Dim var, var2
If ActiveDocument.InlineShapes.Count > 0 Then
  For var = 1 To ActiveDocument.InlineShapes.Count
     Set objInline = ActiveDocument.InlineShapes.Item(var)
        If objInline.Type = 5 Then
           For var2 = 0 To objInline.OLEFormat.Object.ListCount - 1
              MsgBox objInline.OLEFormat.Object.List(var2)
           Next
        End If
  Next
End If
End Sub

The reason the code checks for Type, is in case there is an InlineShape that
is NOT a wdInlineShapeOLEControlObject (type = 5)

You may need to go deeper with this if you have control objects that are not
either listbox or combobox.

You could use a TypeOf check.

However, I question why you are doing this as you have to populate the list
anyway, to get the list in there.  So....you should have the list already.

or are you asking really for something else?

>Hi,
>
[quoted text clipped - 5 lines]
>-----
>Ambiga
fumei - 29 Feb 2008 20:53 GMT
Oh crap.  I was going to use a msg string to build the list into ONE message..
.but then forgot to use it.

>Loads up a Listbox and a Combobox
>
[quoted text clipped - 57 lines]
>>-----
>>Ambiga
Ambiga - 04 Mar 2008 12:07 GMT
Thank for your replies, and that solved the problem.

---
Ambiga



> Oh crap.  I was going to use a msg string to build the list into ONE message..
> .but then forgot to use it.
[quoted text clipped - 60 lines]
> >>-----
> >>Ambiga

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.