QB64 is a modern extended BASIC programming language that retains QBasic/QuickBASIC 4.5 compatibility and compiles native binaries for Windows, Linux, and macOS.

The _CLIPBOARD$ (statement) statement copies the specified STRING value into the operating system’s clipboard.


_CLIPBOARD$ (statement) = string_expression$



Set 2 lines of text in the clipboard using a carriage return to end text lines

DIM CrLf AS STRING * 2            'define as 2 byte STRING
CrLf = CHR$(13) + CHR$(10)        'carriage return & line feed 

_CLIPBOARD$ = "This is line 1" + CrLf + "This is line 2" 
PRINT _CLIPBOARD$                 'display what is in the clipboard

This is line 1

This is line 2

Note: The text in the clipboard could also be sent to a file using PRINT (file statement) _CLIPBOARD$.

See Also