How can I gather data from a text box using a Calc macro?

I have a spreadsheet in Calc. I have placed several text boxes and a button at the top of the sheet. My goal is to take the information that the user inputs in the text boxes then organize it into a list of data. The purpose of the application is to log business expenses into a list that can be easily manipulated to show profit/loss as well as expense categories.

How do I gain access to the information in the textbox?

Form controls belong to databases. If you would simply write your data into database tables, everything would be easy.
For the spreadsheet addicted: [Calc, Basic] Formatted form controls to sheet cells

not sure how far we ve climbed since AOO 2008, but let’s say the subject got recent attention here from Libre Calc Use Form Wizard
where Data Entry Form
and Enhanced Form Extension
are mentionned.

The built-in data entry form is bullshit.
Have you really tested that extension thoroughly with more than 100 records?

None of these tools can hold a candle to the most simple database form. Spreadsheets are a no-go, if you want to collect data for the years to come.

maybe edit your previous post to clarify that well :innocent:

Here you are:
qa65367.ods (67.1 KB) (pseudo-database on sheets for testing the “enhanced form” extension)

This is ridiculous because it lags with 1000 records and the cells are easier to edit without that dialog.

The way to get entered data from a form controil of type TextBox into a cell (or reversely) is to set the property Linked Cell properly.
If you want in addition to move/copy the data elswhere, this can be done by a macro without any reference to the form controls themselves.
Assunming you have linked three textboxes to the cells A1:A3 of thisSheet, your OK Button (action) can call a Sub like

Sub moveDataToCurrentTargetRange(pEvent)
source = thisSheet.getCellRangeByName("A1:A3")
da = source.getDataArray()
target = getCurrentTargetRange(neededParameters) REM (3 rows, one column)
REM Calling a function creating the cellrange to be used to current conditions.
End Sub. 

Details depend on details.

That works for the text boxes. I also have a date and currency text boxes. They do not show that option in the properties window. I there a work around for that?

You may use a TextBox for any entry. To leave the interpretation of the entered text to a macro or to formulas may be simpler than what you originally asked for. That’s because what you had in mind requires to organize the pairing of any form control with its target cell.
Basically form controls are made for usage with database connections.
If you think you need to use form controls not having the Linked Cell property, you may do the pairing by anchoring the control to a cell, and using that cell also for an implicit linkage…
There are disadvantages, however.
If you actually want to do things that way, you will neef to study the usage of the LibreOffice API.

Hi Lupp
Using this macro but getting mssg on 'source line. Object variable not set.

Getting the data to go into the correct cells. Is the OK box a fourth box and where to assign the macro. When the 4th box pressed I want to transfer the data to A1:a3 and clear the boxes and return to first box for new set of data.
Nearly there.

It’s not supposed to be a box at all but an ordinary OK Button (Push Button)

That’s still fact.

@sswcharlie: What you call "this macro" isn’t a macro to run as posted.
It’s your job (at least) to create an actual function getCurrentTargetRange(neededParameters) returning the range object
needed in your specific use-case.

Again it’s your turn to write the needed code.

Text boxes, date controls, time controls, list boxes, combo boxes, pattern fields, currency fields for millions of records.
SimpleInventory_embedded_FB.odb (55.3 KB)