Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 897
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Exported data from Banner database to Excel CBB Excel Worksheet Functions 0 June 4th 10 06:29 PM
Data exported from Lotus approach to excel how do I show it in a u Martin Heathcote Excel Discussion (Misc queries) 0 July 7th 08 10:06 AM
Excel data exported to custom Outlook form Lumpjaw Excel Programming 12 November 20th 06 11:32 PM
Project data exported into Excel JB Excel Programming 3 March 2nd 06 07:53 PM
Exported Data to excel appearing wrong in Columns lwreece Excel Discussion (Misc queries) 4 March 10th 05 11:03 PM


All times are GMT +1. The time now is 10:47 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"