Vb6 writing to excel.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Wernerh
    New Member
    • Jul 2007
    • 104

    Vb6 writing to excel.

    Could anyone tell me what is wrong with my statement?

    [CODE=vb]WSa1.Cells(17, 3).NumberFormat .Font = Bold[/CODE]
    WSa1 is the worksheet name in the Excel book I am writing to, then obviously the cell that needs to be bold.
    It does not bold that text. What have I got wrong in here?
    Thanks Werner
    Last edited by Killer42; Nov 13 '07, 06:44 AM.
  • prakashsakthivel
    New Member
    • Oct 2007
    • 57

    #2
    Originally posted by Wernerh
    Could anyone tell me what is wrong with my statement?

    VB Code:

    WSa1.Cells(17, 3).NumberFormat .Font = Bold

    WSa1 = is the worksheet name in my excel book I am writing to, then obviously the cell that needs to be bold.
    It does not bold that text. What have i got wrong in here?
    Thanks Werner

    Hi Werneth,

    I think you want to format cell content.
    The best and easy way to do so is through the Range object.

    Let's example

    [CODE=vb]'Select cell value as Range

    with WSa1
    .Range("A12:M12 ").Font.Siz e = 14
    .Range("A12:M12 ").Font.Bol d = True
    .Range("A12:M12 ").Borders.Colo r = vbBlack
    End with[/CODE]

    Regards

    Prakashsakthive l
    Last edited by Killer42; Nov 13 '07, 06:45 AM. Reason: Added CODE=vb tag

    Comment

    • Wernerh
      New Member
      • Jul 2007
      • 104

      #3
      Hi,

      Thank you, that really helps.

      Werner

      Comment

      Working...