ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Simple User Form to hold only text (https://www.excelbanter.com/excel-programming/383940-simple-user-form-hold-only-text.html)

Darin Kramer

Simple User Form to hold only text
 
Hi There,

Im trying to find some VB that creates a simple user form with say 10
lines of text underneath each other (Text line 1, text line 2, etc) and
a close button.

Anyone know how.... ?

(PS - User will run a macro that brings up the form - but as the form is
so simple, perhaps there is a less cubersome way to create "pop up" type
info in Excel (not comments or the like!)

Regards

Darin



*** Sent via Developersdex http://www.developersdex.com ***

Tom Ogilvy

Simple User Form to hold only text
 
Sub ShowMessage()
s = "Line 1" & vbNewLine
s = s & "Line 2" & vbNewLine
s = s & "Line 3" & vbNewline
s = s & "Line 4" & vbNewline
s = s & "Line 5" & vbnewlIne
s = s & "Line 6" & vbNewline
s = s & "Line 7" & vbNewline
s = s & "Line 8" & vbNewline
s = s & "Line 9" & vbNewline
s = s & "Line 10"
msgbox s
End Sub

Msgbox will only show 255 lines of text, but perhaps that is sufficient.

--
Regards,
Tom Ogilvy



"Darin Kramer" wrote:

Hi There,

Im trying to find some VB that creates a simple user form with say 10
lines of text underneath each other (Text line 1, text line 2, etc) and
a close button.

Anyone know how.... ?

(PS - User will run a macro that brings up the form - but as the form is
so simple, perhaps there is a less cubersome way to create "pop up" type
info in Excel (not comments or the like!)

Regards

Darin



*** Sent via Developersdex http://www.developersdex.com ***


Darin Kramer

Simple User Form to hold only text
 
Awesome Tom!!! Thanks!
Is there any way to change the name of the box to my own defined name
instead of "Microsoft Excel"

Kind Regards

Darin



*** Sent via Developersdex http://www.developersdex.com ***

Tom Ogilvy

Simple User Form to hold only text
 
Msgbox has several arguments. You might look at the help for a fuller
understanding of its capabilities. Put the code in a module, highight Msgbox
and hit F1. I have added code to change the title.

Sub ShowMessage()
s = "Line 1" & vbNewLine
s = s & "Line 2" & vbNewLine
s = s & "Line 3" & vbNewLine
s = s & "Line 4" & vbNewLine
s = s & "Line 5" & vbNewLine
s = s & "Line 6" & vbNewLine
s = s & "Line 7" & vbNewLine
s = s & "Line 8" & vbNewLine
s = s & "Line 9" & vbNewLine
s = s & "Line 10"
MsgBox Prompt:=s, Buttons:=vbOKOnly, Title:="Darin's advice"
End Sub

--
regards,
Tom Ogilvy


"Darin Kramer" wrote:

Awesome Tom!!! Thanks!
Is there any way to change the name of the box to my own defined name
instead of "Microsoft Excel"

Kind Regards

Darin



*** Sent via Developersdex http://www.developersdex.com ***


Chip Pearson

Simple User Form to hold only text
 
Darin,

You can change the title of the MsgBox by including the "Title" parameter.
E.g.,

MsgBox "Message Text", vbOKOnly, Title:="MsgBox Title"


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)


"Darin Kramer" wrote in message
...
Awesome Tom!!! Thanks!
Is there any way to change the name of the box to my own defined name
instead of "Microsoft Excel"

Kind Regards

Darin



*** Sent via Developersdex http://www.developersdex.com ***




Darin Kramer

Simple User Form to hold only text
 


Thanks so much all!!!

*** Sent via Developersdex http://www.developersdex.com ***

Dana DeLouis

Simple User Form to hold only text
 
Just another similar variation:

Sub Demo()
Dim m As Variant
m = Array( _
"Line 1", _
"Line 2", _
"Line 3", _
"Line 4", _
"Line 5")

MsgBox Join(m, vbNewLine), vbOKOnly, "My Title"
End Sub

--
HTH :)
Dana DeLouis
Windows XP & Office 2007


"Darin Kramer" wrote in message
...


Thanks so much all!!!

*** Sent via Developersdex http://www.developersdex.com ***





All times are GMT +1. The time now is 01:54 PM.

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