OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

How to change cells style in vb?

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Calc
View previous topic :: View next topic  
Author Message
panblackbean
General User
General User


Joined: 20 Oct 2008
Posts: 10

PostPosted: Tue Oct 21, 2008 11:46 pm    Post subject: How to change cells style in vb? Reply with quote

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
View user's profile Send private message MSN Messenger
bobban
OOo Enthusiast
OOo Enthusiast


Joined: 02 Jan 2008
Posts: 172
Location: Australia

PostPosted: Wed Oct 22, 2008 4:41 am    Post subject: Reply with quote

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
View user's profile Send private message
Villeroy
Super User
Super User


Joined: 04 Oct 2004
Posts: 10106
Location: Germany

PostPosted: Wed Oct 22, 2008 5:07 am    Post subject: Reply with quote

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 https://forum.openoffice.org
Back to top
View user's profile Send private message
panblackbean
General User
General User


Joined: 20 Oct 2008
Posts: 10

PostPosted: Wed Oct 22, 2008 6:12 pm    Post subject: Reply with quote

Tankks all
_________________
openoffice
Back to top
View user's profile Send private message MSN Messenger
uros
Super User
Super User


Joined: 22 May 2003
Posts: 601
Location: Slovenia

PostPosted: Wed Oct 22, 2008 10:49 pm    Post subject: Reply with quote

Hi panblackbean!
Download X-Ray tool for browsing thru object properties and methods...
Uros
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Calc All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group