I have a TextBox and I don't want the user to Paste into it.
How do I prevent paste?
Also is a drop of text from another app into a TextBox a Paste event?
As of Windows 8.1, the Windows.UI.XAML.TextBox control has a Paste event handler which fires before the content is inserted into the control. If you set the Handled property to true, the text will not be inserted into the TextBox.
Related
Office 365/Excel, I did the following:
Open New blank workbook.worksheet
Insert activex textbox 3)properties - link to a cell (G1).
But when out of design mode and selecting the textbox to type, the cursor is not showing - that is, no invitation to type anything. If I type something in G1, that value appears in the textbox. If I type something in the textbox, the characters are invisible in the textbox but appear dynamically in G1, and then appear in the textbox when I click outside the textbox.
Also, if I format textbox to change the order to something else (say "bring to front"), I can type in the textbox OK, but when I click outside, the behaviour returns.
I read somewhere a textbox is bi-directional and this appears to be so, except for being unable to see the characters typed in the textbox.
Wondering if you're using external monitors?
There seems to be a bug in Excel and I had the exact same issue. As soon as I unplugged the second monitor or (actually just moving the Excel document to the main screen, the ActiveX textbox was working as intended).
Hope that helps.
I am trying to use a ActiveX Listbox but the click event will not trigger.
Basically I want to a user to click on the list box, activating it, then proceed to click on cells in a specified range which will then add that cells content to the Listbox until the user selects another ActiveX Control or a cell outside the specified range.
I post the code but I dont have any because it will need the click event but basically I planed on using a do while loop that will add the selected cell contents on a click event with some if statements that will deselect the listbox if a cell section occurs outside of the specified range or another control is selected.
I'm working with VBA in Excel 2007.
When I click on my checkbox, I have to do it 2 times before the check mark appears. I have no idea what can cause that. Can somebody help me?
This behaviour is normal when the Excel application is not the active one on your screen (= doesn't have the focus)
the first click is to activate the Excel application window
the second click is to work inside the application.
This applies to Form or ActiveX checkboxes embedded a sheet, it even happens when you want to select a certain cell (say C2) ... when Excel was inactive, the first click (into C3) activates the application and shows the cursor at its previous location (say B3), second click will move cursor to C3.
User forms behave a bit different. Even when they have no focus at first, once you click into a checkbox inside the user form, it activates AND processes the checkbox - except if you trick it out by an event trigger (there are a few that could come in here)
Is it possible to have a macro that, when pressed, pops up a message box asking for a string of text, and then a drop down that has a list of categories?
All I would need it to do is take this information and save it into a cell. If so, how?
[I'm going based on Excel 2007 here, but if you're using 2003, you'll have to navigate the menu structure]
Go to the VBE (by going to the View tab, then click on Macro - creating or editing an existing one will take you there - or click Alt+F11).
Go to the Insert menu, and select Userform. Drag a textbox (the ab|icon), and a combobox onto your form. To set the textbox value to a cell when you change the combobox, create a subroutine in the code to do this by double clicking on the combobox.
Set the combobox items by using the .additem method of comboBox1 in your code. These can be delineated or grabbed from a range in your code (see here)
Within that subroutine, set the value of whatever cell you want to textbox1.Text, which is the contents of the textbox.
I wanted to know after I initialize a combobox, is there a possibility that I can still stay active with the background Excel sheet using the cursor like scroll the sheet up/down, type words on the sheet, etc?
(While at the same time the combobox still stays on top of the Excel sheet doing whatever event you might want to do with your VBA?)
Go to the VBA IDE and select your form. In the properties list (on the left hand side of the screen), find the ShowModal property. Set this to False.
This will prevent the dialog from taking over the window.