von komma4 » Mi, 22.06.2011 10:28
Vielleicht hilft Dir mein folgendes Makro aus dem englischen Forum weiter:
Code: Alles auswählen
Sub ooo124252
' 2011-06-12
' column's A, B, D, G to Q, T, W to AC, AE to AG, and hide them all.
' Then i need to stretch C to be 11 CM and E to be 3CM
oDoc = ThisComponent
oSheets = oDoc.Sheets()
sHide = "A,B,D,G,H,I,J,K,L,M,N,O,P,Q,T,W,X,Y,Z,AA,AB,AC,AE,AF,AG"
sWidth11 = "C"
sWidth3 = "E"
sSheets = "Tabelle1,Tabelle2"
s() = split( sSheets, ",")
h() = split( sHide, "," )
w11() = split( sWidth11, "," )
w3() = split( sWidth3, "," )
' work on every sheetname given
For idxS = 0 To UBound( s )
oSheet = oSheets.getByName( s(idxS) )
For idxH = 0 To UBound( h )
oCol = oSheet.Columns().getByName( h( idxH )
oCol.isVisible = FALSE
Next idxH
For idxW = 0 To UBound( w11 )
oCol = oSheet.Columns().getByName( w11( idxW )
oCol.Width = 11000
Next idxW
For idxW = 0 To UBound( w3 )
oCol = oSheet.Columns().getByName( w3( idxW )
oCol.Width = 3000
Next idxW
Next idxS
End Sub
Blendet die angegebenen Spalten, in den angegebenen Tabellenblättern aus (und setzt die Spalten in
sWidth11 bzw.
sWidth3 auf vorgegebene Breite).
Kannst Du das für Deinen Bedarf anpassen?
Vielleicht hilft Dir mein folgendes Makro aus dem englischen Forum weiter:
[code]Sub ooo124252
' 2011-06-12
' column's A, B, D, G to Q, T, W to AC, AE to AG, and hide them all.
' Then i need to stretch C to be 11 CM and E to be 3CM
oDoc = ThisComponent
oSheets = oDoc.Sheets()
sHide = "A,B,D,G,H,I,J,K,L,M,N,O,P,Q,T,W,X,Y,Z,AA,AB,AC,AE,AF,AG"
sWidth11 = "C"
sWidth3 = "E"
sSheets = "Tabelle1,Tabelle2"
s() = split( sSheets, ",")
h() = split( sHide, "," )
w11() = split( sWidth11, "," )
w3() = split( sWidth3, "," )
' work on every sheetname given
For idxS = 0 To UBound( s )
oSheet = oSheets.getByName( s(idxS) )
For idxH = 0 To UBound( h )
oCol = oSheet.Columns().getByName( h( idxH )
oCol.isVisible = FALSE
Next idxH
For idxW = 0 To UBound( w11 )
oCol = oSheet.Columns().getByName( w11( idxW )
oCol.Width = 11000
Next idxW
For idxW = 0 To UBound( w3 )
oCol = oSheet.Columns().getByName( w3( idxW )
oCol.Width = 3000
Next idxW
Next idxS
End Sub
[/code]
Blendet die angegebenen Spalten, in den angegebenen Tabellenblättern aus (und setzt die Spalten in [color=#0040FF]sWidth11[/color] bzw. [color=#0040FF]sWidth3[/color] auf vorgegebene Breite).
Kannst Du das für Deinen Bedarf anpassen?