Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2003
    Posts
    2

    Red face How to wrap text from excel spreadsheet by VB.

    I want to use multiline in spreadsheet but i try Chr(13) + Chr(10) but it not work. Any idea ???

  2. #2
    Join Date
    Feb 2003
    Location
    Montreal, Canada
    Posts
    117

    Re: How to wrap text from excel spreadsheet by VB.

    Columns("A:A").Select
    Selection.ColumnWidth = 30
    With Selection
    .HorizontalAlignment = xlGeneral
    .VerticalAlignment = xlBottom
    .WrapText = True '!!!!!!!!!!!!!!!!!!!!!
    .Orientation = 0
    End Width

    You can find all these by recording a macro directly in Excel (see tools menu)


    Originally posted by taboty
    I want to use multiline in spreadsheet but i try Chr(13) + Chr(10) but it not work. Any idea ???
    Steve

  3. #3
    Join Date
    Jul 2003
    Posts
    2

    Re: How to wrap text from excel spreadsheet by VB.

    Originally posted by dbadelphes
    Columns("A:A").Select
    Selection.ColumnWidth = 30
    With Selection
    .HorizontalAlignment = xlGeneral
    .VerticalAlignment = xlBottom
    .WrapText = True '!!!!!!!!!!!!!!!!!!!!!
    .Orientation = 0
    End Width

    You can find all these by recording a macro directly in Excel (see tools menu)
    Thank you...Steve
    But i can't to use it in vb with spreadsheet.
    because spreadsheet is not have property "WrapText".
    What can i do ??

  4. #4
    Join Date
    Feb 2003
    Location
    Montreal, Canada
    Posts
    117

    Re: How to wrap text from excel spreadsheet by VB.

    Hi,

    First, you must declare a workbook object, something like:
    Dim wkbNew as Excel.Workbook
    then either you use an existing spreadsheet, either you add a new one:
    Set wkbNew = Workbook.Open 'or Set wkbNew = Workbook.Open "YOUREXCELDOC.XLS"
    wkbNew.Sheets.Add After:=Worksheets(Worksheets.Count)
    wkbNew.Sheets("Sheet1").Select
    Range("A1").Select
    :
    :

    Originally posted by taboty
    Thank you...Steve
    But i can't to use it in vb with spreadsheet.
    because spreadsheet is not have property "WrapText".
    What can i do ??
    Steve

Posting Permissions

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