Page 1 of 1

[Solved] Copy and paste from unbound text box on Form

Posted: Sat Apr 08, 2017 9:01 am
by coopdmc
In visual basic express, I can highlight and automatically copy a text box text (I think to clipboard).

TextBox1.Focus() 'VBA
TextBox1.SelectAll() 'VBA
TextBox1.Copy() 'VBA

I've looked at clipboard operation text in OOBasic, but it's very complicated and verbose.
Is there a way to access the controls (Textbox) properties to highlight and copy an unbound textbox text on a form?

Re: Copy and paste from unbound text box on Form

Posted: Sat Apr 08, 2017 10:58 am
by Villeroy
Well, you start with the most complex parts of this API without knowing the basic parts.

Re: Copy and paste from unbound text box on Form

Posted: Sat Apr 08, 2017 9:09 pm
by coopdmc
Thanks for the response. I looked at several documents regarding application programming interface, using the same interface for several programming languages, and universal network objects
I looked at the IDL Reference at http://www.openoffice.org/api/docs/comm ... le-ix.html. But should a casual user of OpenOffice really need to have a degree in these fields to use OpenOffice at a slightly higher level (such as writing macros)? If so, then I'll certainly pursue this course of action. Do you have a starting point of reference regarding "knowing the basic parts" (of the api)? Thank you for getting me pointed in the right direction!

Re: Copy and paste from unbound text box on Form

Posted: Mon Apr 10, 2017 4:54 am
by UnklDonald418
But should a casual user of OpenOffice really need to have a degree in these fields to use OpenOffice at a slightly higher level (such as writing macros)?
The oO API is complicated, so writing macro code is not something a "casual user" would likely tackle.
Do you have a starting point of reference regarding "knowing the basic parts" (of the api)? Thank you for getting me pointed in the right direction!
Andrew Pitonyak's book “OpenOffice.org Macros Explained” is available as a free download from
http://www.pitonyak.org/oo.php
Also look for his “Database Macros” download
There is another book "Database Programming with OpenOffice.org Base & Basic" that I find helpful, but it isn't free.
http://www.baseprogramming.com/
Also look through the Base Tutorials and Examples and Code Snippets areas for macro examples.

To do much macro programming you will need object inspection tool.
viewtopic.php?f=74&t=49294

Re: Copy and paste from unbound text box on Form

Posted: Mon Apr 10, 2017 8:55 am
by karolus
TextBox1.Focus() 'VBA
TextBox1.SelectAll() 'VBA
TextBox1.Copy() 'VBA
But should a casual user of OpenOffice really need to have a degree in these fields
No, the casual user needs nothing but click … ctrl+a … ctrl+c

Re: Copy and paste from unbound text box on Form

Posted: Tue Apr 11, 2017 12:41 pm
by JeJe
I've quickly found these

Get the textbox contents:

viewtopic.php?f=20&t=84203

Copy to Clipboard:

viewtopic.php?f=20&t=77313

The code to copy to clipboard is complicated - but if you put it in a separate module - once that's done its as easy to call as the VBA copy function. You just need to do a little work first.

Re: Copy and paste from unbound text box on Form

Posted: Wed Apr 12, 2017 1:20 am
by coopdmc
Thanks, all of you for you for your input, very useful links. I've taken another route for my solution, using shell to open a visual basic .exe to generate a random password and convert to hexadecimal for storage:
REM ***** BASIC *****
Sub Main
'20.122. Shell Function (Andrew Pitonyik)
Dim vRC As Variant
Dim sd as integer
sd = 0
vRC = Shell("C:\Users\"user"\Documents\Visual Studio 2015\Projects\encode_030717_2341\encode_030717_2341\bin\Debug\encode_030717_2341.exe", sd)
'(or your path to .bat or .exe program)
End Sub

I'll consider this topic as solved. I knew about Ctrl-C, copy, but was unaware of Ctrl-A, so I did learn something, hi!