Hello,
sometimes I need to execute the macro in the document on a remote ssh server. Here is the command I use:
soffice --headless macro:///Standard.Module1.select_out_of_range tables.xls
It just hangs until I press ctrl+c. Is there the way to do it? Thanks.
(When this macro is running on the local machine, it runs without problems.)
Here is a macro:
sub select_out_of_range
Dim oDescriptor 'The search descriptor
Dim oFound as Object 'The found range
Dim oFoundAll as Object 'The found range
dim oDoc as Object
dim oSheet as Object
oDoc=ThisComponent
oSheet = oDoc.Sheets.getByIndex(0)
oDescriptor = oSheet.createSearchDescriptor()
oDescriptor.SearchString = "^&(.*)"
' oDescriptor.ReplaceString="$1"
oDescriptor.SearchRegularExpression=True
oFoundAll = oSheet.FindAll(oDescriptor)
if not (oFoundAll is Nothing) then
For n = 0 to oFoundAll.getCount()-1
oFound = oFoundAll.getByIndex(n)
oFound.CellBackColor = 12632256
Next
Dim oReplace as Object
oReplace=oSheet.CreateReplaceDescriptor()
oReplace.SearchString = "^&(.*)"
oReplace.ReplaceString="$1"
oReplace.SearchRegularExpression=True
oSheet.ReplaceAll(oReplace)
endif
oColumns = oSheet.getColumns()
iLastColumn = 30 'last column to be applied with OptimalWidth
for iIndex = 0 to iLastColumn
oColumn = oColumns.getByIndex(iIndex)
oColumn.OptimalWidth = true
next iIndex
oSheet.Columns(0).Width=4000
oDoc.store()
' ThisComponent.close(True)
' stardesktop.terminate
end sub