2 small problems

G

Guest

Hi.

I have a txtbox (with multiline) on a userform where the user can write
comments to a cell (excel sheet).

My problem is this: If the user wants to change line in the txtbox by using
enter a square emerge at the end of the line in the sheet. Is it possible to
remove that square?

Is there a vb code that makes it possible to draw in a txtbox (lines,
circles etc.) and return the drawing into a cell?
 
G

Gareth

Hi Michael,

Here's a copy of an answer I made to someone else with the same problem:

<<I suspect this is because the new lines in the textbox are created
with a carriage return and line feed (CHR(13) & CHR(10)) whereas the
Excel cells just use a line feed (CHR(10)). (Although I can't recreate
the problem you experience manually.)

You can clean out the CHR13s by using Replace e.g.
cells("A1") = replace(cells("A1"),vbcr,"")

Replace is only available in Excel 2000 and greater. (You can use athe
worksheet function replace if you're running XL97).

Note however you don't need to do this if you don't copy text and use
code such as:
Cells(1, 1) = TextBox3.Text
to place the text directly in a cell. >>

With respect to drawing in a text box.... I have never heard of such a
control. Off the top of my head, a very poor workaround: You could shell
out to pbrush.exe (maybe dictate the filename?). Pop up a msgbox saying
"click me when you've finished and saved your drawing" and then load the
image up in your userform when they click ok.

I also notice something called Microsoft InkPicture control on my
toolbox that might do exactly what you're looking for. I've never used
it though.

HTH,
Gareth
 
G

Guest

Thank's Gareth
--
Nil Satis Nisi Optimum


Gareth said:
Hi Michael,

Here's a copy of an answer I made to someone else with the same problem:

<<I suspect this is because the new lines in the textbox are created
with a carriage return and line feed (CHR(13) & CHR(10)) whereas the
Excel cells just use a line feed (CHR(10)). (Although I can't recreate
the problem you experience manually.)

You can clean out the CHR13s by using Replace e.g.
cells("A1") = replace(cells("A1"),vbcr,"")

Replace is only available in Excel 2000 and greater. (You can use athe
worksheet function replace if you're running XL97).

Note however you don't need to do this if you don't copy text and use
code such as:
Cells(1, 1) = TextBox3.Text
to place the text directly in a cell. >>

With respect to drawing in a text box.... I have never heard of such a
control. Off the top of my head, a very poor workaround: You could shell
out to pbrush.exe (maybe dictate the filename?). Pop up a msgbox saying
"click me when you've finished and saved your drawing" and then load the
image up in your userform when they click ok.

I also notice something called Microsoft InkPicture control on my
toolbox that might do exactly what you're looking for. I've never used
it though.

HTH,
Gareth
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top