| View previous topic :: View next topic |
| Author |
Message |
panblackbean General User

Joined: 20 Oct 2008 Posts: 10
|
Posted: Tue Oct 21, 2008 11:46 pm Post subject: How to change cells style in vb? |
|
|
oCells = oSheet.getCellRangeByName("A1:A9")
How to merge oCells?
How to change the color of the cell?
How to autoFit column?
Thanks. _________________ openoffice |
|
| Back to top |
|
 |
bobban OOo Enthusiast


Joined: 02 Jan 2008 Posts: 172 Location: Australia
|
Posted: Wed Oct 22, 2008 4:41 am Post subject: |
|
|
| Quote: | | How to change the color of the cell? |
oCells.CellBackColor = RGB (100, 100, 10)
| Quote: | | How to merge oCells? |
oCells.merge(true)
| Quote: | | How to autoFit column? |
Not sure what you mean by this... _________________ nil sine labore |
|
| Back to top |
|
 |
Villeroy Super User


Joined: 04 Oct 2004 Posts: 10065 Location: Germany
|
Posted: Wed Oct 22, 2008 5:07 am Post subject: |
|
|
Hi, just ask the human macro recorders at oooforum.org. They produce even better code than the artificial one in Excel.
| Code: | Sub adjustColumns(oRg)
cols = oRg.getColumns()
for i = 0 to cols.getCount() -1
col=cols.getByIndex(i)
col.OptimalWidth = True
next
End Sub |
EDIT: I forgot to answer the subject line.
| Code: |
obj.CellStyle = strStyleName
|
obj can be a cell, a range or multiple ranges. _________________ Rest in peace, oooforum.org
Get help on http://forum.openoffice.org |
|
| Back to top |
|
 |
panblackbean General User

Joined: 20 Oct 2008 Posts: 10
|
Posted: Wed Oct 22, 2008 6:12 pm Post subject: |
|
|
Tankks all _________________ openoffice |
|
| Back to top |
|
 |
uros Super User


Joined: 22 May 2003 Posts: 601 Location: Slovenia
|
Posted: Wed Oct 22, 2008 10:49 pm Post subject: |
|
|
Hi panblackbean!
Download X-Ray tool for browsing thru object properties and methods...
Uros |
|
| Back to top |
|
 |
|