ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Text Box Scroll Bar question (https://www.excelbanter.com/excel-discussion-misc-queries/220208-text-box-scroll-bar-question.html)

RJQMAN[_2_]

Text Box Scroll Bar question
 
Please forgive my posting this in two groups, but I have not had any
response in the Program group, and I need some help.

I am trying to use a text box on a page (not on a User Form), and I
have pre-loaded information in the box, so that it can be scrolled and
viewed by the user. I would like to do the following, but do not know
how to do it, or even if it is possible;

1) I would like to 'lock' the text so that the user cannot change it.
2) I would like the scroll bar to be at the top whenever the worksheet
is accessed.

The worksheet can only be accessed by a macro, so I could use code for
one or both of these things, but I do not know how to approach it. I
would really appreciate some help. Thanks in advance.

Daniel.C[_3_]

Text Box Scroll Bar question
 
In a standard module, paste :
Public Tb As String
In the "ThisWorkbook" module, paste :
Private Sub Workbook_Open()
Tb = Sheets("Sheet1").TextBox1.Text
End Sub
This will serve to keep the initial value of the textbox.
In the sheet module, paste :
Private Sub TextBox1_Change()
Me.TextBox1 = Tb
End Sub
This will restore the initial text each time it will be modified.
Please note that the text is restored when the textbox loose the focus.
Also, paste :
Private Sub Worksheet_Activate()
TextBox1.Activate
TextBox1.CurLine = 1
Tb = TextBox1.Text
End Sub
to get the beginning of the text of the textbox when the sheet is
selecteed.
HTH
Daniel

Please forgive my posting this in two groups, but I have not had any
response in the Program group, and I need some help.

I am trying to use a text box on a page (not on a User Form), and I
have pre-loaded information in the box, so that it can be scrolled and
viewed by the user. I would like to do the following, but do not know
how to do it, or even if it is possible;

1) I would like to 'lock' the text so that the user cannot change it.
2) I would like the scroll bar to be at the top whenever the worksheet
is accessed.

The worksheet can only be accessed by a macro, so I could use code for
one or both of these things, but I do not know how to approach it. I
would really appreciate some help. Thanks in advance.




RJQMAN[_2_]

Text Box Scroll Bar question
 
On Feb 11, 5:03*am, Daniel.C wrote:
In a standard module, paste :
Public Tb As String
In the "ThisWorkbook" module, paste :
Private Sub Workbook_Open()
Tb = Sheets("Sheet1").TextBox1.Text
End Sub
This will serve to keep the initial value of the textbox.
In the sheet module, paste :
Private Sub TextBox1_Change()
* * Me.TextBox1 = Tb
End Sub
This will restore the initial text each time it will be modified.
Please note that the text is restored when the textbox loose the focus.
Also, paste :
Private Sub Worksheet_Activate()
* * TextBox1.Activate
* * TextBox1.CurLine = 1
* * Tb = TextBox1.Text
End Sub
to get the beginning of the text of the textbox when the sheet is
selecteed.
HTH
Daniel



Please forgive my posting this in two groups, but I have not had any
response in the Program group, and I need some help.


I am trying to use a text box on a page (not on a User Form), and I
have pre-loaded information in the box, so that it can be scrolled and
viewed by the user. *I would like to do the following, but do not know
how to do it, or even if it is possible;


1) I would like to 'lock' the text so that the user cannot change it.
2) I would like the scroll bar to be at the top whenever the worksheet
is accessed.


The worksheet can only be accessed by a macro, so I could use code for
one or both of these things, but I do not know how to approach it. *I
would really appreciate some help. *Thanks in advance.- Hide quoted text -


- Show quoted text -


Wow! Hello Daniel. Thanks so very much. It worked!
FYI - I had to change the curline to "0" instead of "1"in order for
the box to go to the very top line.
Also as far as user changes, it worked even better than expected,
because with the sheet protected, I found that the user cannot change
the text at all. That is exactly what I wanted and what I had hoped
for.
Thanks again.


All times are GMT +1. The time now is 07:14 PM.

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