Hi,
I'm new to OO and I've looked everywhere to find the answer but unfortunately, I can't!
I want to create a button that call a macro to copy the value shown in a textbox in one of the forms within the database.
Example:
Text Box "Employer" is showing the value of "IBM". When I click the custom button, I need the value "IBM" to be copied to the clipboard.
Note: I'm using OO on Mac.
Thank..
BASIC Macro to Copy textbox value to clipboard
BASIC Macro to Copy textbox value to clipboard
OpenOffice 4.0.1
MacOS 10.10.3
MacOS 10.10.3
Re: BASIC Macro to Copy textbox value to clipboard
Please do it manually.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Re: BASIC Macro to Copy textbox value to clipboard
Manually! Can't BASIC handle such things?
OpenOffice 4.0.1
MacOS 10.10.3
MacOS 10.10.3
Re: BASIC Macro to Copy textbox value to clipboard
I'm sure OO BASIC can, but can you write the macro you need? If you make a reasonable attempt you will find good help when we see your code.
Apache OpenOffice 4.1.15 on Xubuntu 22.04.5 LTS
Re: BASIC Macro to Copy textbox value to clipboard
Code: Select all
Global sTxtCString As String
Sub CopyToClipBoard( sText )
Dim oClip, oTR
' create SystemClipboard instance
oClip = CreateUnoService( _
"com.sun.star.datatransfer.clipboard.SystemClipboard")
oTR = createUnoListener("Tr_", _
"com.sun.star.datatransfer.XTransferable")
' set data
oClip.setContents( oTR,Null )
sTxtCString = sText
'oClip.flushClipboard() ' does not work
End Sub
Function Tr_getTransferData( _
aFlavor as com.sun.star.datatransfer.DataFlavor)
If (aFlavor.MimeType = "text/plain;charset=utf-16") Then
Tr_getTransferData() = sTxtCString
End If
End Function
Function Tr_getTransferDataFlavors()
Dim aFlavor As new com.sun.star.datatransfer.DataFlavor
aFlavor.MimeType = "text/plain;charset=utf-16"
aFlavor.HumanPresentableName = "Unicode-Text"
Tr_getTransferDataFlavors() = array( aFlavor )
End Function
Function Tr_isDataFlavorSupported( _
aFlavor as com.sun.star.datatransfer.DataFlavor ) as Boolean
If aFlavor.MimeType = "text/plain;charset=utf-16" Then
Tr_isDataFlavorSupported = true
Else
Tr_isDataFlavorSupported = false
End If
End Function
Apache OpenOffice 4.1.1
Windows 7 SP1
Windows 7 SP1
Re: BASIC Macro to Copy textbox value to clipboard
Thanks.dndn wrote:CreateUnoService( _
"com.sun.star.datatransfer.clipboard.SystemClipboard")
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice