CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Align in excel

  1. #1
    Join Date
    May 2000
    Location
    Belgium, Bruges
    Posts
    146

    Align in excel

    Can anybody help me with the alignment in excel (i create an excel file from VB 6.0)

    newbook.worksheets(1).range("A1:Z6").Align ????

    Thanx


  2. #2
    Join Date
    Jan 2000
    Location
    Olen, Belgium
    Posts
    2,477

    Re: Align in excel

    You can use the horizontalalignment and the verticalalignment properties of the range.

    newbook.worksheets(1).range("A1:Z6").HorizontalAlignment = xlCenter



    Tom Cannaerts
    [email protected]

    Programming today is a race between software engineers striving to build bigger and better idot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook
    Tom Cannaerts
    email: [email protected]
    www.tom.be (dutch site)

  3. #3
    Join Date
    May 2000
    Location
    New York, NY, USA
    Posts
    2,878

    Re: Align in excel

    Dim xlSheet as Excel.Worksheet

    xlApp.Visible = true

    set xlWorkbook = xlApp.Workbooks.Add

    set xlSheet = xlWorkbook.Sheets(1)

    With xlSheet.Cells(1, 1)
    .Value = "Hello"
    .HorizontalAlignment = xlCenter ' Center
    .HorizontalAlignment = xlRight ' Right Align
    .HorizontalAlignment = xlLeft ' Left Align

    .VerticalAlignment = xlBottom ' Bottom
    .VerticalAlignment = xlCenter ' Center
    .VerticalAlignment = xlTop ' Top

    End With

    xlWorkbook.Close false

    xlApp.Quit



    Iouri Boutchkine
    [email protected]
    Iouri Boutchkine
    [email protected]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured