Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

is this possible? Access2002 and excel

Status
Not open for further replies.

mavog

IS-IT--Management
Jun 12, 2003
25
GB
Hi all,
the db allows users to click a button that exports a report to excel. They would like the report the set the cell's property to wrap-text. Any1 know how to do this?
 
This should get you started:
Code:
Function ExcelCellWrap()
On Error GoTo ErrHandler

  Dim xl As Excel.Application
  Dim wb As Excel.Workbook
  Dim sht As Excel.Worksheet
  Dim rng As Excel.Range
  
  Set xl = New Excel.Application
  Set wb = xl.Workbooks.Open("C:\TestWrap.xls")
  Set sht = wb.Sheets("Sheet1")
  Set rng = sht.Range("A1:H10")

  With rng
    .Value = "This is a long text string to test word wrapping..."
    .WrapText = True
  End With
  
  xl.Visible = True
    
ExitHere:
  Exit Function
ErrHandler:
  MsgBox "Error: " & Err & " - " & Err.Description
  Resume ExitHere
End Function


VBSlammer
redinvader3walking.gif

Unemployed in Houston, Texas
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top