Logo 
Search:

MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

Basic Cell manipulation by code

  Asked By: Howard    Date: Nov 18    Category: MS Office    Views: 777
  

I'm writing an app in VB6 (yeah, not VBA, but close !!)
and need to manipulate cell characteristics.

What I've figured out so far:

1. Place a value in a cell.

With WS
-- v1 = "hello world"
-- rr = 1
-- cc = 3
-- .Cells(rr, cc).Value = v1
End With

2. FontBold

With WS
-- .Range("G3").Font.Bold = True
End With

3. Merge

With WS
-- .Range("C3","D3").Merge
End With

Here's what I'm having trouble figuring out what to do:

4. cell backcolor (I know RGB(), just can't find "root")
5. cell alignment (center, left, right, etc)

I can't seem to find the proper "root" property to
expose these sub-properties in the tooltip box once I
type the "." (the dot reference) while I'm coding.
I'm used to MSHFlexGrid jargon, and the real deal, Excel,
is somewhat different. Any ideas?

Share: 

 

4 Answers Found

 
Answer #1    Answered By: Lurlene Fischer     Answered On: Nov 18

It is ages since I used VB6 but I think you could set a reference to the Excel
object model, then you should be able to use all the Excel objects. Some of
them may need to be prefixed with excel. If they conflict with VB objects.
Unless a reference is set you cannot use intellisense.

 
Answer #2    Answered By: Helene Stewart     Answered On: Nov 18


You may find this of use:

http://www.mrexcel.com/archive2/18800/21312.htm

It's a subroutine to display the attributes of the active cell.
Manipulation of them would just be changing the values.

 
Answer #3    Answered By: Feodora Bonkob     Answered On: Nov 18

look for the myCDType() subroutine on the page...

 
Answer #4    Answered By: Della Simpson     Answered On: Nov 18

Cell alignment is .HorizontalAlignment = 3 (for centered).
Randy, your link was helpful in seeing a list of the
constants (such as xlCenter).

As for backcolor, it is .Interior.Color=RGB(200,200,200),
to do light grey, for example.

 
Didn't find what you were looking for? Find more on Basic Cell manipulation by code Or get search suggestion and latest updates.




Tagged: