[Solved] Post data to a Calc Textbox using Basic?

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
rdwray

[Solved] Post data to a Calc Textbox using Basic?

Post by rdwray »

Welcome beginner. Please answer all of the questions below which may provide information necessary to answer your question.
-----------------------------------------------------------------------------------------------------------
Which version of OpenOffice.org are you using? 2.4.1
What Operating System (version) are you using? XP Pro
What is your question or comment?

I am new to OO and I am having an issue with Textboxes on a spreadsheet. Basically, I want to build a form on a spreadsheet using Labels, Textboxes and Buttons with code being written in Basic. I have done a lot of work in Excel, but the property information in Calc is limited. How can I place a Textbox on a spreadsheet and use a Button to return information from Basic to the Textbox? I am not very smart, so please keep simple. Thanks...
Last edited by Hagar Delest on Mon Jul 07, 2008 11:20 pm, edited 1 time in total.
Reason: tagged the thread as Solved.
JohnV
Volunteer
Posts: 1585
Joined: Mon Oct 08, 2007 1:32 am
Location: Kentucky, USA

Re: How can data be posted to a Textbox using Basic?

Post by JohnV »

Assuming a text box named TB1 on Sheet1.

Code: Select all

Sub Main
oSheet = ThisComponent.Sheets.getByIndex(0)
oDP = oSheet.getDrawPage.Forms.getByName("Standard")
oTB = oDP.getByName("TB1")
oTB.String = "New text"
End Sub
rdwray

Re: How can data be posted to a Textbox using Basic?

Post by rdwray »

Issue solved; see JohnV's post below. Thanks JohnV, this clears up the issue of accessing object properties.
Post Reply