Macro to get values range of cells V22 to V221 (only not empty cells) and save it to txt file on desktop

@JohnSUN:yes , more exactly:

desk_from_Path = Path().home()  /  'Desktop'
desk_from_ospath = os.path.expanduser('~/Desktop')
print(str(desk_from_Path) ==  desk_from_ospath)
> True

print( desk_from_Path.exists() )
> False #because no 'Desktopfolder' here 

print( os.path.exists(desk_from_ospath)
> False


Path() returns Path_objects with also an String-representation
os.path.expanduser(’~/Desktop’) returns String only

Of course there is the Documentation

edit: one more funny Method:

print( desk_from_Path.with_name( 'Schreibtisch' ).exists() )
> True
# because here is a *Schreibtisch* instead a *Desktop* …-folder.

karolus thanks for the effort, but I would like the macro to be written in Basic.

You’re a true romantic.

Then read Andrew’s book forward and backward for the next few months.
Around Christmas you will master copy&paste, but nothing else essential.

Andrew’s most famous texts concerning the context, “the book” (OpenOffice.org Macros Explained) and “Useful Macro Information”, both give their working examples in Basic, and the book even has chapters explicitly addressing StarBasic (pdf, third edition: up to chapter 9 of 16, pp1…226 vs. 227…581). However, their main value lies in their introduction to and exemplification of the API usage.

If you want an efficient UDF, the disadvantages of Basic are obvious, and in some cases even prohibitive.

If we talk about “document automation” and related topics the usage of the API may be indispensable, and some of the included services actually provide efficient means. In these cases the choice of the language can be a marginal decision, and the “broad and short” bridge to the API StarBasic comes with may be advantageous.

Then there are the users who won’t simply waste-bin their knowledge concerning Basic, may it even not be very profound, and to start studying something new to them. I wouldn’t call them morons just for this decision. (They may be nonetheless for different reasons.)