Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
vb project data exported to excel
Hello;
Can someone please tell me how to write the code I need to use word wrap. I have a vb 2005 app that exports the data into excel and I want the data in each row to use word wrap for every text columm. The code below only sets the column heading, I thought it would set all column per row (example cloumn a1 is name so all rows for a1 should be set with word wrap) SetColumnsFormat(oExcel) Private Function SetColumnsFormat(ByVal oExcel As Object) As Boolean For i As Integer = 0 To lstColumnsSelected.Items.Count - 1 Application.DoEvents() Dim myExcel As Excel_ = oExcel Dim col As dcColumn col = lstColumnsSelected.Items.Item(i) Dim nmLwr As String = col.Name.ToLower() Select Case col.Type Case 1 ' Text Type R,Col Width myExcel.WrapText(1, i + 1, True) Continue For Case 2 ' Date Type myExcel.FormatWidth(1, i + 1, col.Width) Continue For Case 3 ' Hours Col Format myExcel.FormatNum(i + 1, "###0") myExcel.FormatWidth(1, i + 1, col.Width) Continue For Case 4 ' Money myExcel.FormatNum(i + 1, "###,##0.00") myExcel.FormatWidth(1, i + 1, col.Width) Continue For Case 5 ' Months myExcel.FormatNum(i + 1, "##0.0") myExcel.FormatWidth(1, i + 1, col.Width) Continue For Case Else myExcel.FormatWidth(1, i + 1, col.Width) End Select Next i End Function What am I doing wrong? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
vb project data exported to excel
On Feb 25, 10:27*am, confused wrote:
Hello; Can someone please tell me how to write the code I need to use word wrap. I have avb2005 app that exports the data into excel and I want the data in each row to use word wrap for every text columm. *The code below only sets the column heading, I thought it would set all column per row (example cloumn a1 is name so all rows for a1 should be set with word wrap) SetColumnsFormat(oExcel) Private Function SetColumnsFormat(ByVal oExcel As Object) As Boolean * * * * For i As Integer = 0 To lstColumnsSelected.Items.Count - 1 * * * * * * Application.DoEvents() * * * * * * Dim myExcel As Excel_ = oExcel * * * * * * Dim col As dcColumn * * * * * * col = lstColumnsSelected.Items.Item(i) * * * * * * Dim nmLwr As String = col.Name.ToLower() * * * * * * Select Case col.Type * * * * * * * * Case 1 * * * * * * * * * * * ' Text Type R,Col * Width * * * * * * * * * * myExcel.WrapText(1, i + 1, True) * * * * * * * * * * Continue For * * * * * * * * Case 2 * ' *Date Type * * * * * * * * * * myExcel.FormatWidth(1, i + 1, col.Width) * * * * * * * * * * Continue For * * * * * * * * Case 3 * ' *Hours *Col * *Format * * * * * * * * * * myExcel.FormatNum(i + 1, "###0") * * * * * * * * * * myExcel.FormatWidth(1, i + 1, col.Width) * * * * * * * * * * Continue For * * * * * * * * Case 4 * ' *Money * * * * * * * * * * myExcel.FormatNum(i + 1, "###,##0.00") * * * * * * * * * * myExcel.FormatWidth(1, i + 1, col.Width) * * * * * * * * * * Continue For * * * * * * * * Case 5 * ' *Months * * * * * * * * * * myExcel.FormatNum(i + 1, "##0.0") * * * * * * * * * * myExcel.FormatWidth(1, i + 1, col.Width) * * * * * * * * * * Continue For * * * * * * * * Case Else * * * * * * * * * * myExcel.FormatWidth(1, i + 1, col.Width) * * * * * * End Select * * * * Next i * * End Function What am I doing wrong? Found my answer, doesn't seem to be much help on this group. Don't know how to close this topic, if I could , I would |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
vb project data exported to excel
Maybe you should have posted this in a VB newsgroup?
--JP On Feb 26, 3:26*pm, confused wrote: On Feb 25, 10:27*am, confused wrote: Hello; Can someone please tell me how to write the code I need to use word wrap. I have a vb2005 app that exports the data into excel and I want the data in each row to use word wrap for every text columm. *The code below only sets the column heading, I thought it would set all column per row (example cloumn a1 is name so all rows for a1 should be set with word wrap) Found my answer, doesn't seem to be much help on this group. *Don't know how to close this topic, if I could , I would - Show quoted text - |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Exported data from Banner database to Excel | Excel Worksheet Functions | |||
Data exported from Lotus approach to excel how do I show it in a u | Excel Discussion (Misc queries) | |||
Excel data exported to custom Outlook form | Excel Programming | |||
Project data exported into Excel | Excel Programming | |||
Exported Data to excel appearing wrong in Columns | Excel Discussion (Misc queries) |