Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Print TextBox properties, Label Properties 2

Status
Not open for further replies.

WaterSprite

Technical User
Mar 23, 2004
69
US
Is there a method to print the "properties" boxes of TextBoxes or Labels that reside on a UserForm?
 
Hi,

And the reason would be.......?

Have you tried looking at HELP in VBA or
Skip,

[glasses] [red]Be Advised![/red] A chicken, who would drag a wagon across the road for 2 cents, is…
POULTRY in motion to PULLET for a PALTRY amount! [tongue]
 
Skip,

I did textboxes and label boxes that have multiple lines of text and numbers in each box. Part of it was done by manipulation of the properties of the textboxes and labels. If I could print them, then I would have them for future reference.
VBA help had nothing, assuming I asked the correct question. Did not try Microsoft.com.
 

Display the Properties menu.

[PrintScreen]

paste into any application

print

Skip,

[glasses] [red]Be Advised![/red] A chicken, who would drag a wagon across the road for 2 cents, is…
POULTRY in motion to PULLET for a PALTRY amount! [tongue]
 
Pardon me for asking...but explain this again?

You have multiple lines of text (or numbers) IN the textboxes, and labels. OK. What manipulation of the properties? .Text, hmmm, .Caption, hmmm .Value.

I don't get it. What future reference? You could run code to print out these values. YOU are putting them in. Why do you need a print of the Properties?

Not that I am disagreeing, I just would like to know why you need to do this.

Gerry
 
Skip, fumei,

I assume there are a lot of folks like me on this forum, completely self taught. All I know of VBA is from books, going online, the help files etc, and just trying stuff until something works, then going on to the next thing.
I work in a water plant, and a water plant runs on numbers, as do a lot of things. We have a very nice SCADA system at the plant that brings anything I want into an Excel spreadsheet. I have been able to completely automate all of the reports that I have to do by using VBA and "Task Scheduler"
I used the "concatenate" command? in Excel, grouped a bunch of cells together, then put all those into one cell. Did this several times, each for a different chlorinator, then put it all into one textbox. Part of what I had to do to make it work was set stuff in the properties of the textbox, wordwrap, etc. I can't remember it all right now and the code is at work, I don't have an example at home to send you. Anyway, I have a userform with a textbox in it and the textbox has several lines of text in the box. I don't have any formal training, and maybe I took the long way home, but, the code works and I figured it out myself by just trying stuff.
 
Whoa...we are definitely not being critical, or even asking for justification for what you are doing. We - or at least me...I can't speak for Skip...although...tempting...nah, better not - just want to know why you are doing something.

Uh...I have to say...I still don't.
Did this several times, each for a different chlorinator, then put it all into one textbox.
Why????
Part of what I had to do to make it work was set stuff in the properties of the textbox, wordwrap, etc.
When you have time, I would be interested in exactly what and why you are doing...whatever it is you are doing.

BUT...I think I finally see part of your point. You want to see what you did. Close??

Hmmm, there are better ways. And it would help you learn.

I really AM interested in why you seem to be, hmmm, pooling text into one textbox. But...whatever.

Gerry
 
Sorry, in any case, no, you can not print directly the Properties. As Skip mentioned, do a PrintScreen, and dump that into something. Heck...use Excel if you have to. It will take the paste from a PrintScreen.

Gerry
 
fumei , remember, you asked for this.

And I did not take any offense at your questioning me, it is just that as far as I know, no one else is using VBA and or VB6 in quite the way I am doing. So, it is a struggle, plus no one to "high 5" with when I do make something work.

I am pooling the info into one textbox because the chlorine feed is in stages from beginning to end. There is cause and effect, if the one that feeds point B fails, then the one at point C better be setting ready to go when its feedback loop reports a low residual. So, they need to see the whole process at one time, not one box for Pre-Chlorine, another for CT values to the Clearwell, and then a third for polishing the water as it leaves.

As I mentioned, water plant. Chemical feeds and dosages are absolutely critical. In water treatment, you are not allowed any "oops". The first bit, the "Concatenate" statment, brings back info about one of the chlorinators. We have 5 chlorinators, they can feed different places in the plant if we so desire. This statement tells the operators what the chlorinator should be doing, as well as tell them what it is doing. What they see is a userform. They click on a "command Button", an input box pops up and asks them how many hours they want info for. They enter a number, click ok. The Historian is searched, the spreadsheet is calculated, then the TextBox tells them what each Chlorinator has been doing for the requested time period.
So from row A22 through row A29, are the "Concatenate" statements.
Then, in Q27 are all of the info from those rows. Then, at the bottom, you can see some of the code I wrote to get the info into a text box. The reason I wanted to print the properties of the text box is so I would have future reference to how I set Autosize, Multiline, Wordwrap, etc.
And, I know that my code is ugly, ungainly, slow, etc, but most of the time, it gets the job done until I can learn better ways of coding.

=(CONCATENATE("7-E-4,RAW WTR DOSAGE,",CHAR(32),FIXED($B$10,2),CHAR(32),"CALC PPD",CHAR(32),FIXED($C$10,0),CHAR(32),"CALC VARIABLE",CHAR(32),FIXED($I$10,2),CHAR(32),CHAR(32),"ACTUAL PPD",CHAR(32),FIXED($F$10,0),CHAR(32),"ACTUAL VARIABLE",CHAR(32),FIXED($J$10,2),CHAR(32),""))

=($A$22) & CHAR(10) & ($A$23) & CHAR(10) & ($A$24) & CHAR(10) & ($A$25) & CHAR(10) & ($A$26) & CHAR(10) & ($A$27) & CHAR(10) & ($A$28)

Private Sub CommandButton1_Click()
Dim MyTime, MyDate, MyStr
Dim MyNum As Range
Set MyDate = Worksheets("Sheet3").Range("S27")
Set MyNum = Worksheets("Sheet3").Range("c1")
MyNum = Application.InputBox("Enter number of hours desired")
Worksheets("Sheet3").Application.Calculate
Worksheets("Sheet3").Range("$G$19").Value = Format(MyDate, "dddd, mmm dd yyyy hh:mm")
Label1.Caption = Now()
Label2.Caption = Worksheets("Sheet3").Range("K6")
Worksheets("Sheet3").Application.Calculate
TextBox1.MultiLine = True
TextBox1.Value = Worksheets("Sheet3").Range("Q27")
TextBox2.MultiLine = True
TextBox2.Value = Worksheets("Sheet3").Range("Q28")
TextBox3.MultiLine = True
TextBox3.Value = Worksheets("Sheet3").Range("Q29")

End Sub
 
Sorry. i still don't get it.

1. You are setting MultiLine = True. OK. But are you ever setting it to False? If you are NOT, then why do with code?

2. A deep explanation of your real world work flow is not really required, but it helps a little I guess. But your code does not help settle this at all. You have three different textboxes getting three values. Ok. Sure.
The reason I wanted to print the properties of the text box is so I would have future reference to how I set Autosize, Multiline, Wordwrap, etc.
Still don't get it. Help works like a charm for this....

Further, following what you are saying, you don't want the values of any particular textbox, just how to set the properties. Hmmm. Make a list. Look in Help.

Do a PrintScreen.

However, back to the issue. WHY? WHY? WHY? are you changing any of the properties in the first place.

Are you resizing it? Does not seem to be. So set it as AutoSize...and forget about it. Are wanting to have it MultiLine False some times, and MultiLine True at others? If not, set it and forget about it.

A textbox can take your multiple lines easily. I am a purist when it comes to this. If YOU, as the programmer, are putting the text (or .Value) into a textbox - then you should NOT, repeat NOT, be using a textbox. Textboxes are for USER input, not program content. Use a label. Textboxes look like (and rightly so) they take input. And they do. WHY display text in a control the user can change???? If the user is not to make changes...use a label.

Bottom line...I still don't get it. You can take your mulitple values and display them.
So, they need to see the whole process at one time, not one box for Pre-Chlorine, another for CT values to the Clearwell, and then a third for polishing the water as it leaves.
So display them. It does not matter if it is a listing of book titles, changes of clothes you made, or clorination processes. It is a display of information.

Heck you could make your userform have a MultiPage. The user clicks the commandbutton, the userform gets the data, turns to the next page, and uses the whole page to display the entire process. No textbox, just one big label.

Gerry
 
The Textbox.multiline code should come out, agreed.

I displayed the stuff the way I did because it was the only way I knew how.

I probably used the textboxes to display the rows of data because I saw lines of code somewhere that used textboxes that way. I will change the textboxes to labels.

I will go to help and type in Multipage in the search box.
I did not know about Multipage userforms.
 
They are a little tricky at first, but if you have a userform where you want lots of room, or multiple subjects to deal with, they are great. They are not multipage userforms, they are controls.

Gerry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top