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

Joined: 11 Apr 2008 Posts: 3 Location: Sint-Niklaas, Belgium
|
Posted: Fri Apr 11, 2008 10:55 am Post subject: How te get Text Box value into a variable in a macro |
|
|
Hi,
I am writing a macro which makes a drawing depending on the input a user gives in a text box.
My problem is that I want to get the user input into a variable so that I can work with this information in the macro. And I haven't found what I am looking for on internet and even not in this forum (or did I overlook ?).
Can anybody help ?
Thanks,
Marc |
|
| Back to top |
|
 |
JohnV Administrator

Joined: 07 Mar 2003 Posts: 8983 Location: Lexinton, Kentucky, USA
|
Posted: Fri Apr 11, 2008 12:54 pm Post subject: |
|
|
Assuming the Text Box is the only thing in a Draw document this should get the text in it. | Code: | Sub Main
oDoc = ThisComponent
oDPages = oDoc.getDrawPages
oDP = oDPages.getByIndex(0)
oTB = oDP.getByIndex(0)
sText = oTB.Control.String
MsgBox sText
End Sub |
|
|
| Back to top |
|
 |
MarcG Newbie

Joined: 11 Apr 2008 Posts: 3 Location: Sint-Niklaas, Belgium
|
Posted: Fri Apr 11, 2008 10:16 pm Post subject: |
|
|
Thanks John,
that is the kind of information I needed.
I have got 1 more elements on the page, that is a button to start drawing, but in the code, it is just a matter of using the right index, so that won't be a problem.
I don't have time now, I'll try the code later and let you know more.
Thanks,
Marc  |
|
| Back to top |
|
 |
MarcG Newbie

Joined: 11 Apr 2008 Posts: 3 Location: Sint-Niklaas, Belgium
|
Posted: Sun Apr 13, 2008 12:15 am Post subject: |
|
|
Hi John,
I tested your example code and it works fine.
Now I can continue working on the macro.
Thanks !  |
|
| Back to top |
|
 |
|