Disable the VBA code editor window in Excel 2010 - excel

I am looking for a possibility to add an additional level of security to my Excel projects.
We have multiple users. Some who know (and are meant to) the password that unlocks the VBA macros. Others are not meant to be able to access these.
I'm not sure if someone has the password that shouldn't (changing the password hasn't stopped tampering) so i would like to disable the VBA editing window for any user not approved. I can't find any way to do this though, is it possible?
I can't disable the save option as all users need to save data.
I have tried to disable the ribbon icons etc, but with no sucess. It is still possible to open the code window with Alt+F11.
Any help would be great.

I am coming from Excel 2003, but this concept should work for you as well. You could think of
trapping the Alt-F11 key (Application.OnKey "%{F11}" "MyNullSub") plus
disable the relevant menu entries (Application.CommandBars(...).FindControl(ID:=..).OnAction = "MyNullSub")
with
Sub MyNullSub()
' do nothing
End Sub
as a dependency of an entry in the registry that needs to be present (GetSetting(...)), but this will only help until this additional secret is spread around in the same way the (changed) passwords apparently did.

Related

VBA automatically agree to enable macros

I have a VBA code that is opening a lot of different excel files with macros. However, every time VBA opens a file, it says "Microsoft Office has identified a potential security concern", and I have to select "Enable Macros". Is there a way to add a line, that would always choose "Enable Macros", as I cannot change any excel settings (it is a corporate computer, without admin rights)?
Thank you!
Typically when opening a macro-enabled file using code, there's no security prompt. It would help to show the code you're using to open the files.
However if you do see a prompt you can fix that by setting Application.AutomationSecurity to the appropriate value
See: https://learn.microsoft.com/en-us/office/vba/api/excel.application.automationsecurity

Using a macro/script to open a hyperlink in Excel - How to bypass the security of opening a file?

When you click a link in an Excel workbook, you get a warning 'Some files contain virus ... Would you like to open this file?'
Is there a way to turn this off/include it in a macro or script?
I have a macro that opens the link, but you have to manually click 'Yes' to keep the macro running. I want to run the macro and not have to do any user inputs. I've google'd it and there's a bunch of Registry Edit methods which don't seem to work for me. Any other ways to accomplish this?
There is a good reason for the macro runs to be prevented per default. Power plants have been attacked successfully because someone did run an Excel macro. The world would be a better place if the macros never existed. Look at least over the first 10 minutes.
https://youtu.be/xVBaPZqoLkc?t=910
Security that can be bypassed is no security! Actually that is why you cannot bypass security.
There is no way to bypass this warning. The messeage is there for a good reason.
Otherwise your macro could download a dangerous file and run the code in that file without warning the user.

How to Trigger/Initialise Excel VB User Forms Without Showing the Workbooks?

I have created an excel vba tool that utilises userforms to create a shopping experience for the user. Once the user opens the tool he will be able to pick orders from the user form. The code then processes the orders and returns with a calculated estimated cost.
The Problem is I don't want to let the workbook(and sheets in it) visible to the user. I need to hide my active workbook without any pop ups.
I recently crossed with the below solution however, I found out that upon initial launch by the user, he encountered "Security Warning Macros have been disabled. Enable Content (button)" which renders the initial solution worthless. Any advice is appreciated. TIA.
ActiveWorkbook.Windows(1).Visible = False
forgot to mention the obvious
XLAM
save your book as an xlam. put it in the addin folder (or explicitly point to it) and select it through Excel's interface.
addins are not visible by default
you still have to manage the security warning, frankly this is a user concern that you'll likely be forced to address and it's an issue that will never go away.
i will not say this is "good" advice and you may scof or reject the idea on principle, but if you don't have a legit way of signing your projects, consider the possibility of installing a personal cert on the users computer and signing the project locally or walking users through the process remotely
You can permanently enable macros for a certain workbook in the Trust Center of the excel workbook. So whenever the user opens the workbook, he/she will not need press the button each time to activate anything macro related.
In your case you want to select: Enable all macros (not recommended; potentially dangerous code can run)

Is default open mode for ExCel (Office 365) configurable?

I googled around and found no answer for what I think should be an obvious question/problem, so I'll ask here.
I have an ExCel spreadsheet that I want to share with a couple other guys. Version, as far as I can tell, is "Office 365 ProPlus" (sorry if that's wrong, I'm a linux guy). I do the vast majority of the writing/editing, the other guys mostly just read it. I put it on a shared drive. But when they open it, it opens in edit mode and I'm locked out because one of the other guys (who just wanted to read it) opened it and the default open mode is edit.
I want to change the default open mode to be read_only. If I want to open for edit, I don't mind clicking a few times to get to that point. But what I can't have is being locked out because the read_only guys have it locked. If they have it locked because they're making changes, that's fine. But for the 95% of the time, where I write and they read, I don't want them to unintentionally lock the thing when all they want to do is read.
Is this sort of thing possible ? Can I configure this ?
You may save your document as "Read-only recommended" and get your friends to open it read-only whenever they do not need to edit the document:
For the new versions (2013 & 2016), while Saving or Saving As your file press Browse button, go to Tools | General Options and select the Read-only recommended check box. If you want you may enter a password too. After this, the users will be recommended to open the document as read only; if they want, they may still open the file in edit mode.
In addition you may use the shared workbook feature of Excel which allows multi users to edit the document at the same time. And using this way you may track which changes are made when and by whom too.This feature can be activated using Review / Share Workbook button. If you have a newer version of Excel, this button is hidden, you may unhide it using the instructions here: unhide shared workbook
Old post but I just had the same question and landed here. I was also suspecting the Office version but it turns out that's not it. I figured it out that instead of going to the File-Properties you have to go to the "Save As..." dialog box, and there, next to the Save / Cancel buttons, is the Tools... dialog where you can set a "Read-only recommended" check mark.
I think the implication is that it's not a document property, it's a windows file property - that's why it's not in the File-Options menu.
After I found it, I remembered that this is how I always used to do it in old versions of Excel many years ago, so it's really unchanged.

How to disable auto backspace in Excel VBA editor

When typing in the editor it puts me back on the end of the last word.
For example, I want Sub Entername()
If I'm not typing quickly enough it goes: SubEnterName().
How do I turn this off.
I've heard of this problem before. Try these steps:
Close down excel.
Open it first it in safe mode (type "excel.exe /s" in the run box).
Open the VBA Editor and attempt to write a macro. The issue should not occur
Close down excel and re open it normally
I've heard these steps have fixed this issue before for others.
Are you using any VBE addins like Smart Indenter or Code Cleaner? Remove Code Cleaner and install it only when you are going to use it, then uninstall it when you are done. I had the same problem and Code Cleaner was the culprit. I believe it might be the two of them together that causes it.
For reference:
VBA Code Cleaner
Smart Indenter
This issue is because of a COM Add-In called 'Load Test Report Addin'. to disable it, do the following:
go to Excel Options -> Add-Ins and choose Excel COM Add-ins from bottom drop down and press Go... button. then uncheck the 'Load Test Report Addin' item to diable it. this will clear the problem!
To prevent auto refreshing and deleting back-spaces in VBA editor, you should make sure that all forms or reports that have On-Timer Event Procedures are in design view or the code should be turned-off (i.e. converted into comments).
However, it is better to make sure that all forms and reports are in design view which means none of the On-Timer codes are executing.
I hope this helps.
Shafiu.
Do you have AutoSave turned on? I had a file doing this just now. While typing, as SOON as I stopped, AutoSave was working away - (inadvertently, I'm sure) this was causing VBE to kill spaces.
Did two tests:
-Moved the file off Sharepoint onto my local machine, worked fine
-Turned off AutoSave on the Sharepoint copy, worked fine

Resources