Hello.
I want to 'copy' the textbox.value, which is in disabled frame.
Any ideas?
Thanks!!
Hello.
I want to 'copy' the textbox.value, which is in disabled frame.
Any ideas?
Thanks!!
After you copy the textbox.value what will happen next?
N323100, I can't 'tuch' the textbox (I can't select the text, neither activate the textbox). It's in a disabled frame (wich I wan't to be enabled)![]()
Maybe you set the textbox properties to Enable = False?
The frame containing the textbox and other objects is disabled and I want it to stay disabled. I want the user to be able to copy the textbox's value only. How can I achieve that?
Copy the text box and what? Do you want the contents to go to a particular cell or just to the clipboard?
Also, where is this text box? In a user form or on a worksheet?
_
...How to Cross-post politely...
..Wrap code by selecting the code and clicking the # or read this. Thank you.
e.g.
Capture.JPG
I want copy the value '12345abcde' from the textbox1, or copy the value 'qwe' form the textbox2.
But the Frame1 is disabled and I want it to stay disabled.
Just to the clipboard.
I use userform (in VBA).
The Frame being disabled doesn't effect the code. This sub will put the text of TextBox1 into the clipboard.
![]()
Sub Copy TestBox1ToClipboard() Dim myObj As New DataObject myObj.SetText TextBox1.Text myObj.PutInClipboard Set myObj = Nothing End Sub
Thans mikerickson I know that. Βut the point is the user can, somehow, to choose which textbox to copy.
Perhaps with the coordinates of the mouse? But, I think, these do not exist above a disabled frame...
A listbox (or a series of checkboxes) at the side of the Frame is one notion.
Alternatly, you could Enable the Frame, but disable each of its controls. The the Frame's MouseMove event could be polled to see where the user is pointing.
I wanted to avoid it, because there are many elements within the frame, but eventually I will do it.
Thank you all very much.![]()
I think that I've found something interesting. If a Frame contains a Label, the Label's MouseDown event fires if the Label is enabled, even if the frame is no enabled.
So if you put a Label in the frame of interest and have its Enabled property opposite of the Frame's, then when the Frame is dis-abled, the Lable's mouseDown event can be polled to see if the user clicked above a text box.
In the attached, there is this code. Note that the CheckBox1_Click event is there to control the enabling of Frame1 AND that it uses the created Frame1Enabled property rather than the Frame1.Enabled property.
Invoke the user form, click on the check box to disable the frame and then click on some text boxes. Look at the user form caption to see what is happening. (Note that first time that one clicks on the frame after it is dialed nothing is registered.)
![]()
' in userform code module Public WithEvents CoverLabel As MSForms.Label Rem make a label in the Frame of interest Private Sub UserForm_Initialize() Set CoverLabel = Frame1.Controls.Add("forms.Label.1") With CoverLabel .BackStyle = fmBackStyleTransparent .Top = 0 .Left = 0 .Height = .Parent.Height .Width = .Parent.Width .Enabled = False .ZOrder fmZOrderFront End With End Sub Rem create a property to control Frame1 being enabled/disabled (and new Label being dis/enabled) Property Get Frame1Enabled() As Boolean Frame1Enabled = Frame1.Enabled End Property Property Let Frame1Enabled(inVal As Boolean) Frame1.Enabled = inVal CoverLabel.Enabled = Not inVal End Property Private Sub CheckBox1_Click() Rem checkbox for testing purposes Frame1Enabled = CheckBox1.Value End Sub Private Sub CoverLabel_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Single, ByVal y As Single) Dim oneControl As MSForms.Control Dim ClickedTextBox As MSForms.TextBox For Each oneControl In Frame1.Controls If TypeName(oneControl) = "TextBox" Then With oneControl If .Left < x And x < .Left + .Width And .Top < y And y < .Top + .Height Then Set ClickedTextBox = oneControl Exit For End If End With End If Next oneControl If oneControl Is Nothing Then Me.Caption = "no control clicked" Else Me.Caption = ClickedTextBox.Name & " clicked" End If End Sub
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks