| View previous topic :: View next topic |
| Author |
Message |
LewisGalloway Newbie

Joined: 29 Sep 2004 Posts: 3 Location: CA
|
Posted: Wed Sep 29, 2004 11:03 am Post subject: Combobox - how do you know what is selected |
|
|
How do you get the value selected, using the comboboxes. Tried to do it using similar methods as ListBox but that didnt work. I am using StarOffice and writting macros, to access info in sheets. I have inclueded the code below and any assistance would be great !!!
Sub ListBoxSelected
Dim Doc As Object
Dim Sheet As Object
Dim DrawPage As Object
Dim Form As Object
Dim Ctl As Object
Dim Array(15) As String
ReDim Array2(15) As String
Dim TestString As Object
Doc = StarDesktop.CurrentComponent
Sheet = Doc.Sheets(0)
DrawPage = Sheet.DrawPage
Form = DrawPage.Forms.GetByIndex(0)
Ctl = Form.getByName("MainOwner")
< what comes next ..., tried 'selectedItems' cmd but it didnt work, an example of how to do it woould be great? > |
|
| Back to top |
|
 |
SergeM Super User

Joined: 09 Sep 2003 Posts: 3211 Location: Troyes France
|
|
| Back to top |
|
 |
LewisGalloway Newbie

Joined: 29 Sep 2004 Posts: 3 Location: CA
|
Posted: Wed Sep 29, 2004 12:19 pm Post subject: Ctl.State doesnt work we get a property or method not found. |
|
|
"Main Owner" is the name of the combobox (as in a pull-down menu).
The Ctl.State is useful for option and checkboxes but not comboboxes. But stillCtl.State returns 'property or method not found'. Only one option will be selected at a time the way I am using them. The documentation should allow the use of '.SelectedItems' to get an array of strings, of the selected items, I will only need the first. This doesnt work though I get the same error 'property or method not found'. |
|
| Back to top |
|
 |
pitonyak Administrator


Joined: 09 Mar 2004 Posts: 3618 Location: Columbus, Ohio, USA
|
Posted: Wed Sep 29, 2004 6:58 pm Post subject: |
|
|
I have very little information on a combobox control in my free macro document. My book, however, has some information:
| Quote: | | Provides text input or selection from a list of text values. |
I discuss this on page 428 in my book (if you have it). You need to look at the Text property to see what the selected value is.
Does this help? _________________ --
Andrew Pitonyak
http://www.pitonyak.org/oo.php |
|
| Back to top |
|
 |
LewisGalloway Newbie

Joined: 29 Sep 2004 Posts: 3 Location: CA
|
Posted: Thu Sep 30, 2004 8:20 am Post subject: |
|
|
| Yes this is exactly what I needed, thanks. |
|
| Back to top |
|
 |
|