|
|
#1 |
|
Addicted Member
Join Date: May 06
Location: Mexico City
Posts: 146
![]() |
Suppose you have a cell with the following value: "Line one and line 2". You set the format of the cell to wrap text and you change its size so that it looks like:
Line one and line 2 Is it possible in vba to extract tomething like "Line one and" & vbLine & "line 2"? I think you can somehow deduce how many rows the cell has if you use my_rows=round(cell(1,1).height / cell(1,1).font.size, 0) so you can actually know how many vbLine to use. But still it's incomplete... |
|
|
|
|
|
#2 |
|
PowerPoster
Join Date: Dec 04
Posts: 11,787
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Re: Wrap text
i played with this, but it is not correct
vb Code:
also excel will wrap words at point where there is no space if the word is too long and i did not test for that, though it could be done
__________________
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case. Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part come back and mark your original post as resolved if your problem is fixed pete |
|
|
|
|
|
#3 |
|
PowerPoster
Join Date: Dec 04
Posts: 11,787
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Re: Wrap text
i have been able to make this work, but it will return the lines as displayed in cells edit mode may change slightly after leaving the cell
requires use of activex dll
__________________
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case. Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part come back and mark your original post as resolved if your problem is fixed pete |
|
|
|
![]() |
|
||||||
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|