Ark68
Well-known Member
- Joined
- Mar 23, 2004
- Messages
- 4,570
- Office Version
- 365
- 2016
- Platform
- Windows
I am looking for some help to create a VBA solution to this concept. I hope someone can offer some direction.
I have a string variable, tfd, with a value of "The rich look of hand crafted granite". This string is 37 characters in length.
I need to put this value into a cell of a static height height and width, so autofit with word wrap isn't an option. At 37 characters, this value will not fit into the cell with the loss of many of it's characters.
I have included an input box requesting the user reduce the number of characters so that it will fit into the cell. However, the challenge I have found is I'm not sure what the maximum number of characters would be. I manually entered a series of capital M into the cell and counted 19 as the maximum. But when I adjusted the value of tfd to under 20 characters, there was still lots of room in the cell. So I don't think using the series of Ms provided an accurate account of how many characters could fit into that cell. We know it can only fit 19 Ms if the value of tfd was all Ms.
Is there a means that the point at which word wrap would wrap a string be calculated. One would figure then that the maximum number of characters of a particular string that could fit in that cell would be thoise between the start of the string, and the point at which it would initiate the text wrap. So in this case, if the string would word wrap at the "d" in "crafted" (position 29), then we can conclude the maximum length of that string to fit in that cell would be 29 characters.
I have a string variable, tfd, with a value of "The rich look of hand crafted granite". This string is 37 characters in length.
I need to put this value into a cell of a static height height and width, so autofit with word wrap isn't an option. At 37 characters, this value will not fit into the cell with the loss of many of it's characters.
I have included an input box requesting the user reduce the number of characters so that it will fit into the cell. However, the challenge I have found is I'm not sure what the maximum number of characters would be. I manually entered a series of capital M into the cell and counted 19 as the maximum. But when I adjusted the value of tfd to under 20 characters, there was still lots of room in the cell. So I don't think using the series of Ms provided an accurate account of how many characters could fit into that cell. We know it can only fit 19 Ms if the value of tfd was all Ms.
Is there a means that the point at which word wrap would wrap a string be calculated. One would figure then that the maximum number of characters of a particular string that could fit in that cell would be thoise between the start of the string, and the point at which it would initiate the text wrap. So in this case, if the string would word wrap at the "d" in "crafted" (position 29), then we can conclude the maximum length of that string to fit in that cell would be 29 characters.