| View previous topic :: View next topic |
| Author |
Message |
Janko Wisniewski Guest
|
Posted: Mon Apr 07, 2003 11:26 pm Post subject: Can anyone send a spreadsheet with working ComboBox & Da |
|
|
Hello.
As in topic. Big request to anyone who can send me a spreadsheet and data source (if needed) with working combo box? I built one, can choose items but cannot bound it to any cell. I need a sample to learn. Please...
Janko Wisniewski
jan28ko@hoga.pl |
|
| Back to top |
|
 |
Skeeve General User


Joined: 09 Apr 2003 Posts: 31 Location: Germany
|
Posted: Sun Apr 13, 2003 12:14 pm Post subject: |
|
|
Give me an example what you need.
But I fear you will have to use a macro in order to link some form element to cells. |
|
| Back to top |
|
 |
Andy Guest
|
Posted: Thu May 01, 2003 6:07 am Post subject: Comboboxes returning values to cells |
|
|
I have exactly the same question, you beat me too it!
Ideally Data Validation would include a List option as per Excel as it's a lot faster to create, but a combobox is the closest thing I can find. I just can't return a selected value to any cell. Surely it's not a macro issue?
Help! |
|
| Back to top |
|
 |
pep Guest
|
Posted: Fri May 23, 2003 9:27 am Post subject: ComboBOx WORKING!!! |
|
|
I would like to make it WITHOUT a macro, like excel, where you select a list in the properties of the combobox... but this is the only way i know by now.
FIrst you select the View > toolbars > Main toolbar, this is the tool of left side.
Press the button number 5: "show form functions" until a toolbar popsup.
Then select combobox and draw it in any part.
Cancel the autopilot.
Selected this combo, you will see near an anchor. This says that you are in edit mode. (After all of this you will must to press the button "Design mode on/off" to get the form works!!!.)
Well, we continue in edit mode.
Right button and select :
| Quote: |
In FORM properties:
Name..........Cable (the name of this combobox)
URL...........
Frame........
Type.........Get
Subm......URL
In the combox properties CONTROL: GENERAL
Name.....ComboBox (i dont change anything, i dont know why)
....
Default value..........THIS is a ComboBox (obvious, the default value)
In the combox properties CONTROL: DATA
...
In the combox properties CONTROL: EVENTS
Text modified.......................macro to WRiITE new values
When receiving focus.........macro to LOAD the list of valid entries
|
And now the macros:
| Code: |
Sub Write_Cell_destination_value()
Dim oDoc As Object
Dim oSheet As Object
Dim oForm As Object
Dim oComboBox As Object
Dim oCellRangeDestination As Object
Set oDoc = ThisComponent
'now we get the active sheet
Set oSheet = oDoc.CurrentController.getActiveSheet()
'now i suppose we get the form named Cable
Set oForm = oSheet.DrawPage.Forms.GetByName("Cable")
Set oComboBox = oform.getByName("ComboBox")
'Defines BF9 the cell to receive the SAME VALUE OR TEXT selected
Set oCellRangeDestination = oSheet.getCellRangeByName("BF9")
oCellRangeDestination.FormulaLocal = oComboBox.text
End Sub
Sub Load_List_Values()
Dim oDoc As Object
Dim oSheet As Object
Dim oSheet2 As Object
Dim oForm As Object
Dim oComboBox As Object
Dim oCellRangeSource As Object
Dim aSourceDataArray()
Dim aDataArrayRow()
Dim aSource() As String
Dim I As Integer
Set oDoc = ThisComponent
'get active sheet
Set oSheet = oDoc.CurrentController.getActiveSheet()
'n the case the list is in the sheet "sheet_with_list"
Set oSheet2 = oDoc.Sheets.GetByName("sheet_with_list")
'get the form
Set oForm = oSheet.DrawPage.Forms.GetByName("Cable")
Set oComboBox = oform.getByName("ComboBox")
'get the list
Set oCellRangeSource = oSheet2.getCellRangeByName("A10:A22")
'extract the data from the range
aSourceDataArray() = oCellRangeSource.getDataArray()
Redim Preserve aSource(UBound(aSourceDataArray())) As String
'
For I = LBound(aSource()) To UBound(aSource())
aDataArrayRow() = aSourceDataArray(I)
aSource(I) = aDataArrayRow(0)
Next I
oComboBox.StringItemList = aSource()
End Sub
|
IWhen you load the archive, you will see that the combo is charged of values automatically....
IF you have more combos,
you must change his name "Cable" to another but not the name of "ComboBox"
I have some forms working in the same sheet with different names but without changing the "ComboBox" name of CONTROL-General properties. So, if you change them for each combo and dont woks remember this.
ALL THIS CODE HAS BEEN MADE THANKS TO A LOT OF DOCS FINDED ON THE WEB and i dont know how work some macro sentences... but its OK!!!
¡ ¡ ¡ SORRY MY BAD english ! ! ! ! |
|
| Back to top |
|
 |
georgir Guest
|
Posted: Thu May 29, 2003 11:16 pm Post subject: Re: ComboBOX WORKING!!! |
|
|
| pep wrote: | | ALL THIS CODE HAS BEEN MADE THANKS TO A LOT OF DOCS FINDED ON THE WEB |
hey pep :) nice job. this code you gave us is very useful.
i wonder where can i learn to create macros like this? what docs have you read?
i installed OpenOffice but there isnt any help about the macro language. can you give me an address in internet where to read?
and once again thanks for the code. |
|
| Back to top |
|
 |
pepe General User

Joined: 26 May 2003 Posts: 7 Location: Spain
|
|
| Back to top |
|
 |
goa103 OOo Advocate


Joined: 11 May 2003 Posts: 279
|
Posted: Sun Mar 14, 2004 6:14 am Post subject: Re: To Georgir : where are my sources... |
|
|
| pepe wrote: | | and after doing some little and basic program make questions in this forum and in news.sun.comp.starbasic |
What is « news.sun.comp.starbasic » ? I thought it was a Usenet group but it doesn't exist. I searched for it on Google and only found this topic... _________________ An OOo mascot designer |
|
| Back to top |
|
 |
|