ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Text box problem (https://www.excelbanter.com/excel-programming/376743-text-box-problem.html)

pjbur2005 via OfficeKB.com

Text box problem
 
I have searched long and hard for the solution to this problem.

I have a complicate form using Excel as a platform and VBA to control and
manage the form.

Its completed by users on a network.

my problem is this:

information from another source is brought into the form and populates
sections of this form. Thi info first goes to a cell on an information sheet
which is not seen or used by user (xlveryhiddedn). this is linked to the text
box. Because this info is more than 1024 characters long but is lno more than
2000 characters long I have used text boxes embedded on the form created
from the control toolbox.

What i now want to do is prevent users from adding to or changing the
information that comes into the form. now i have changed the enabled
propperty to false which does the job BUT this grays the text on view ( not
too much of a problem) but on printing makes it virtually unreadable.

ok with VBA code

hope this enouth info

thanks in advance

--
Message posted via http://www.officekb.com


Jay

Text box problem
 
Have you tried setting the 'Locked' property of the textbox to True? You may
have to unlock it programmatically prior to filling it with a value...

UserForm1.TextBox1.Locked = True (or 'False' as needed).

--
Jay


"pjbur2005 via OfficeKB.com" wrote:

I have searched long and hard for the solution to this problem.

I have a complicate form using Excel as a platform and VBA to control and
manage the form.

Its completed by users on a network.

my problem is this:

information from another source is brought into the form and populates
sections of this form. Thi info first goes to a cell on an information sheet
which is not seen or used by user (xlveryhiddedn). this is linked to the text
box. Because this info is more than 1024 characters long but is lno more than
2000 characters long I have used text boxes embedded on the form created
from the control toolbox.

What i now want to do is prevent users from adding to or changing the
information that comes into the form. now i have changed the enabled
propperty to false which does the job BUT this grays the text on view ( not
too much of a problem) but on printing makes it virtually unreadable.

ok with VBA code

hope this enouth info

thanks in advance

--
Message posted via http://www.officekb.com



pjbur2005 via OfficeKB.com

Text box problem
 
Jay thanks for your reply,

the textbox is embedded on a worksheet. when the textbox locked property is
set to true you can still enter text on a protected sheet!

An idea I tried late last night was toto prevent users from alteringthe text
in the textbox was to put another textbox over the top with the enabled
property = false locked = true and backstyle set to transparant. then the
user may clcik on area where text box is but cant att to Textbox 1. Not
ideal but does work

Paul

Jay wrote:
Have you tried setting the 'Locked' property of the textbox to True? You may
have to unlock it programmatically prior to filling it with a value...

UserForm1.TextBox1.Locked = True (or 'False' as needed).

I have searched long and hard for the solution to this problem.

[quoted text clipped - 22 lines]

thanks in advance


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200611/1


Jay

Text box problem
 
Nice work-around ! (There's always a way, isn't there?). I thought your
textbox was on a userform, but I get the same result as you experience (can't
lock) when it is on a worksheet. You'd think there would be a way, but I
couldn't find it either.

When a textbox is on a worksheet, you can set its Locked property to True
(as I suggested), but in that case, Locked means that you can't select and
move or resize the box (you can still edit its value as you discovered).
However, when the textbox is on a UserForm, the same Locked property does
lock users from editing the value in the textbox.

I suppose you could potentially insert a new userform with a textbox, set
its locked property to true in its initialize event, and get the result
you're looking for (an uneditable textbox). However, this might not suit
your application (you probably have a good reason for embedding the textbox
on a worksheet and not on a userform).

Forfuture reference in case a userform would work, insert a new userform
into your application, add a textbox to it, and set the userform's initialize
event code to the following:

Private Sub UserForm_Initialize()
Me.TextBox1.Locked = True
End Sub

Also, set the UserForm's "ShowModal" property to False so users can move
around the worksheet while the form (and its textbox) is visible on the
screen.

--
Jay


"pjbur2005 via OfficeKB.com" wrote:

Jay thanks for your reply,

the textbox is embedded on a worksheet. when the textbox locked property is
set to true you can still enter text on a protected sheet!

An idea I tried late last night was toto prevent users from alteringthe text
in the textbox was to put another textbox over the top with the enabled
property = false locked = true and backstyle set to transparant. then the
user may clcik on area where text box is but cant att to Textbox 1. Not
ideal but does work

Paul

Jay wrote:
Have you tried setting the 'Locked' property of the textbox to True? You may
have to unlock it programmatically prior to filling it with a value...

UserForm1.TextBox1.Locked = True (or 'False' as needed).

I have searched long and hard for the solution to this problem.

[quoted text clipped - 22 lines]

thanks in advance


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200611/1




All times are GMT +1. The time now is 12:05 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com