Seite 1 von 1

Re: Makro Copy Paste ohne Leerzeilen

Verfasst: Do, 29.01.2015 05:48
von Stephan
möglicherweise mit:

Code: Alles auswählen

sub ORT
rem ----------------------------------------------------------------------
rem define variables
dim document   as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document   = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")

rem ----------------------------------------------------------------------
dim args1(0) as new com.sun.star.beans.PropertyValue
args1(0).Name = "ToPoint"
args1(0).Value = "$D$13"

dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args1())

rem ----------------------------------------------------------------------
dim args2(0) as new com.sun.star.beans.PropertyValue
args2(0).Name = "Format"
args2(0).Value = 1

dispatcher.executeDispatch(document, ".uno:PasteSpecial", "", 0, args2())

x = ThisComponent.getCurrentSelection
x1 = x(0).Text.CreateTextCursor
k = Split(x1.String, CHR(13))
k1 = ""
For i = 0 To UBOUND(k())
	If LEN(k(i)) > 1 Then
		k1 = k1 & k(i) & CHR(13)
	End If 
Next i
tmp = LEN(k1)
k1 = LEFT(k1, tmp-1) 'letztes CHR(13) weg
x1.String = k1

end Sub
Gruß
Stephan

Re: Makro Copy Paste ohne Leerzeilen

Verfasst: Do, 29.01.2015 10:10
von Karolus
Hallo

@Stephan
Warum letzteres nicht schlicht mit:

Code: Alles auswählen

sel = thisComponent.CurrentSelection
stext = sel.String
sel.String = replace(stext, chr(13)&chr(13), chr(13))

Re: Makro Copy Paste ohne Leerzeilen

Verfasst: Do, 29.01.2015 11:09
von Stephan
Warum letzteres nicht schlicht mit:
weil ich nicht wusste ob CHR(13) oder CHR(10) und das schrittweise ausprobiert habe und dann nicht weiter über Verkürzung nachgedacht habe


Gruß
Stephan