Senin, 20 Juni 2011

[ExcelVBA] Re: Input Box w/selection

 

Or, you can set-up a couple of variables to allow for changes until the textbox is exited:

Dim UserText As String
Dim IsTextEntered As Boolean

Private Sub TextBox1_Change()
If IsTextEntered Then
Me.TextBox1.Value = UserText
Exit Sub
End If
UserText = Me.TextBox1.Value
End Sub

Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If Me.TextBox1.Value <> "" Then IsTextEntered = True
End Sub

Dave Gathmann

--- In ExcelVBA@yahoogroups.com, "Charlie" <railroads@...> wrote:
>
> Hi
>
> I can report all working well. Learnt heaps as well. Set up a userform with a text box, 3 combos and a command button. Placing the info where I want it and the form closes down also.
>
> One minor problem - with the text box. I have changed in the properties the 'enable' to false, so that the text cannot be changed by the user, works ok, except that the text on the userform in operation is greyed out (half usual brightness). Is there a setting to keep the text nice and black but unable to be changed by the user ?
>
>
> Thanks for all your help.
>
> Charlie Harris
>
>
> From: Paul Vermeulen
> Sent: Monday, June 20, 2011 2:19 PM
> To: ExcelVBA@yahoogroups.com
> Subject: RE: [ExcelVBA] Input Box w/selection
>
>
>
> Hi Charlie
>
> You have to split your problem into two, then the answer is simple.
> First, design an input box in the VBE (Insert UserForm), type the
> question into the Caption field, and insert a combo box from the
> Toolbox, along with two CommandButtons (OK and Cancel buttons).
>
> Now write your code to check whether something has been selected before
> accepting OK, Cancel = End, give it a try and let us know how you get
> on.
>
> Regards
>
> Paul
>
> From: ExcelVBA@yahoogroups.com [mailto:ExcelVBA@yahoogroups.com] On
> Behalf Of railroads@...
> Sent: Saturday, 18 June 2011 4:17 PM
> To: ExcelVBA@yahoogroups.com
> Subject: [ExcelVBA] Input Box w/selection
>
> Hi
>
> I want to use a input box in some code. Would like, where the box asks
> for user input, to have a drop down to select required input. Is this
> possible with input box (like a combo)? if I use a combobox there is no
> place to put the question.
>
> Your comments appreciated.
>
> Thanks
>
> Charlie Harris
>
> [Non-text portions of this message have been removed]
>
>
>
>
>
> [Non-text portions of this message have been removed]
>

__._,_.___
Recent Activity:
----------------------------------
Be sure to check out TechTrax Ezine for many, free Excel VBA articles! Go here: http://www.mousetrax.com/techtrax to enter the ezine, then search the ARCHIVES for EXCEL VBA.

----------------------------------
Visit our ExcelVBA group home page for more info and support files:
http://groups.yahoo.com/group/ExcelVBA

----------------------------------
More free tutorials and resources available at:
http://www.mousetrax.com

----------------------------------
.

__,_._,___

Tidak ada komentar:

Posting Komentar