Excel VBA - Allow input to cells with DisplayFormulaBar=False - vba

OK it's taken me a while to figure this out and it is extremely annoying...
Excel 2013 Pro Plus Fully patched to July 2014
In my project I have
Application.DisplayFormulaBar = False
which works as expected, it hides the FormulaBar. What is NOT expected is that it Stops the inputting of data into any cell.
I have to do a
Application.DisplayFormulaBar = True
to allow the inputting of data again which is inconsistent with the design of the application.
Does anyone know of anyway to hide the FormulaBar and still allow input into cells?
I'm using my own validation inside the VBA code to ensure right place and value...other cells are locked.
Many thanks in advance,
regards
Seán

I'm a Program Manager on the Excel team, and I wanted to provide some input on a bug we discovered that seems related to what we are seeing. Specifically, in Excel 2013 and later, when the formula bar is disabled, you (1) call DisplayAlerts = false (2) from an ActiveX control, you will get into a state where you can no longer edit cells. You didn't mention conditions #1 and #2, but it seemed related, and it might be the same issue you are seeing.
We are fixing this particular issue in an upcoming update to Office365. If you get into this state, one way to work around it by setting DisplayFormulaBar to true, then back to false.

Press Alt+T+O
Advanced
Editing Options
Give a Tick Mark in Allow Editing Directly in Cells
Source (scroll down)

Related

Forms not saving

Firstly, I apologise for my terminology and sometimes stupidity, as I am completely self/internet (mostly on here) taught. I've been developing an app for the past few years, mostly to help me with work, and more for kicks and giggles. I have now run into a problem that has me stumped! So I am calling out for any suggestions please :)
Okay, some background, I use colours on all forms to identify blocks of data based on an ID - it looks pretty, okay; and sometimes it's a quick identifier of which block the data belongs to when skimming through tables. So I have a form where I or the user can change these colours to whatever suits their eyes, needs etc. and there is a table that holds this information. Now these colours are applied using the 'Conditional Formatting' (when ID = 1 then background this colour, font that colour, etc). When a Form is opened in the FormLoad() code there is a check to see if the colours have been changed and if so then a module is called which updates all the 'Conditional Formats' on the Form (I should add here that it's only applied to the tables on the form), and everything looks pretty and more important works! Now this process is relatively slow (a couple of seconds on some forms), too slow to run every time the form is opened. So ages ago I found a way to force Access to save the design, including the 'Conditional Formatting':
DoCmd.RunCommand (acCmdDesignView)
Forms!PrePlanner!BtnHelp.Caption = "Help"
DoCmd.Save acForm, "PrePlanner"
DoCmd.Close acForm, "PrePlanner", acSaveYes
This works perfectly on some forms but not on other!!
At first I thought it was something to do with the subForms, as it WASN'T working on all the forms that have subForms and the ones it was working on had no subForms... So I copied one of a simple subForms (a recently created form) which can open as a normal form, made changes to the colours opened the TEST form, the colours updated as expected, closed the form with the above code and the Formatting WASN'T saved! :( (If I change the Help Button to say "Help!" this change IS saved)
The Forms that don't save with the above code are also the most recent Forms that I have designed, the ones that do save are older forms (a couple years old and designed on a different computer but the same version of Access). I copied one of these older Forms, changed the colours, etc etc and this it DID save!!!
I've been through and compared all the properties of a working form and a nonworking form and nothing, I've tried exporting and importing... Please any thoughts would really help my sanity!!
Thanks in advance
....I forgot to say that I'm using Access 2016 on a 64bit Windows 10 machine.
Additional Info.
Having played around this morning, I created a new form (from scratch) configured the records so that the Conditional Formatting can be applied, etc. Opened the new form the Conditional Formatting was updated, the form closed and saved. Upon reopening the new form everything was as it should be the Conditional Formatting was saved. So I then add a subForm, and tried again, the Conditional Formatting was updated, the from closed BUT this time without saving the Conditional Formatting!! I then removed the subForm and repeated the test, this time the Conditional Formatting was saved.
So it seems to be something to do with subForms, what changes to the form properties does adding a subForm trigger that would stop the Conditional Formatting from being saved? Is this a quirk in Access?
Thanks again.
Have you tried running your code to apply the formatting while the form is in design view? It seems like conditional formatting and properties don't save when updated via VBA while the form is in normal view mode. I've had good luck reopening the form in design, running the code, and then saving the form.

Cannot edit cells after touching combobox - I think i've encountered a bug

So here i was building a form in excel for work ya, and to make it easy on the eyes and fool proof i removed 90% of the UI. On that form i put some activex combo boxes. Everything was perfect, and then i tried to edit a cell after i entered in the data in that combo box, but low to my woes i couldnt.
It seemed that touching the combo box locked every other cell in the form. Flabbergasted i did some experimenting and found a way to isolate the issue. Thus i created a test environment for the error(doc linked below). When the UI is removed clicking the combobox locks all other cells. But when the UI is there, no issue happens. Furthermore it seems the formula bar being disabled is the cause.
Is this a bug, a programming error, or something else. I'm at a total lost and would appreciate any help.
My test File, for those how want to try it
When in edit mode shift+esc to hide UI, when hidden hold shift+ctrl then type edit to bring back UI.

Need help on excel autocomplete function for drop-down list

I'm trying to add an auto-complete function to some of the boxes on the first sheet that I have for entering data on an excel worksheet, but I can't figure out how so. Here's the link for the excel document. https://drive.google.com/file/d/0B2ksoDGxry1tR2JGNnhoSEZuYU0/view?usp=sharing
I have read some of the articles here but I didn't really get how to apply them to my work.
There is a very handy guide for doing just that, but you need to rely on a mixture of VBA and form controls, specifically comboboxes. The initial method was outlined in a slightly revamped guide by Contextures.
This guide was later expanded into, what I felt, was a slightly easier and more robust method dubbed "the magical floating activeX control".
I hope you have luck with those two - but knowledge of VBA will help you get the most out of it. You have to customize their setup to match your data structures. I use this method to produce 'autocomplete' forms for users in my organization. So far, my one extension has been to make an 'on/off' button for this code, because it's method runs constantly, meaning that you lose the ability to do UNDO in excel while the lookup/autocomplete code is available to the user. I strongly advise setting up a button/feature that allows a user to disable it when not in use.
For enable/disable, here is the very-rough code that will do the job to ensure the code doesn't execute when you don't want it to. This disables the 'catch' that watches for the intial value change in the script from the links above.
If Application.EnableEvents = False Then
Application.EnableEvents = True
btn_Enable.ForeColor = 0
Else
Application.EnableEvents = False
btn_Enable.ForeColor = 35653
End If

ActiveX controls changing to pictures (Excel/VBA)

My company creates workbooks for clients that contain ActiveX controls (in most cases we need the extra functionality as compared to Form Controls). When we create them, they work fine on our end, but when we zip them up and send them to our clients, they open the WB and the ActiveX controls are no longer ActiveX controls, if you right click it, it behaves like a picture.
I feel like this is due to the MS ActiveX debacle. I have had them run the Fix It and making sure all the MS Office components were closed, and had them reboot, but still nothing.
I am pulling out my hair, and have asked on other forums if anyone else has had this issue, and what they have done to fix it. Thanks in advance.
Could you please check in client system whether macros and active x controls are enabled in Trust center setting?
https://support.office.microsoft.com/en-us/article/Enable-or-disable-macros-in-Office-documents-7b4fdd2e-174f-47e2-9611-9efe4f860b12?CorrelationId=fe6a4d24-f4d9-4c6b-afa0-40d2828ad22e&ui=en-US&rs=en-US&ad=US
use above link if needed.
Try closing excel and deleting the .EXD files from your computer.
Source: http://www.mrexcel.com/forum/excel-questions/296750-command-button-turned-into-image.html
While saving the Excel document, save it as "Macro enabled workbook".xlsm
In my case, the worksheet prompts a non responsive error sometimes. When I reopen it, Excel repairs it and turns all active X check boxes (sometimes drop down list and command buttons) into images. It happened many times and I had to spend a lot of my time recreating them and liking to cells.
I experienced a similar problem when Excel repaired a file; this may be similar to what's happening with the Zipped file. FormControl Buttons don't appear to have the same problems but I see you want to keep the additional functionality of the ActiveX Control.
You may be able to make use of the code I created by inserting one Form Control button that runs the Sub RepairMissingButtons() that your clients can press to restore the images to CommandButtons. This currently fixes buttons for any selected sheets, so you'd want to first identify which sheets need to be selected (or add a form control button on each sheet that needs the repair done).
You'd need to modify the Sub CreateButton() to meet your needs (currently requires hard-coding the Caption, BackColor and any other ActiveX properties that may have been lost by the button being converted to an image):
Reverse Excel ActiveX command buttons erroneously converted to images after corrupted file repair
Having this problem, activex controls sometimes change to pictures.
Many places around the internet the answer is: Use form controls, well as far as I can tell form controls don't actually do anything useful.
Even Microsoft's support site says, recommend using form controls, how can that be the answer. being able to interact with VBA is as far as I can tell the only reason to use Microsoft applications instead of free ones.

Check box disabling

I am doing a project of managing a database. Here I have to make a checklist wherein a check box in an MS-Access 2007 form employees have to check in so that their responses get registered in the database. But, after a certain time, that is the deadline field, I want to disable the check box so that no more checking in is allowed. I am completely new to VBA. I would be very thankful if someone could help me out or guide me through the programming part of this.
In your VBA that will control this checkbox, there's a few options you can use.
MyCheckBox.Enabled = False
MyCheckBox.Locked = True
MyCheckBox.Visible = False
The first one will disable the control and grey it out.
The second one will lock out any changes, but it stays the same color.
The third one will completely hide it.
Hope this helps. Good luck.