Excel Macro - disabling "file now available for editing" msg - vba

How do you disable the pop up message:
File now available for editing.
in Excel?
I couldnt do it in my python code so I am trying to see if I can do it within Excel macro. Do I apply the macro to the master copy, or the one I am opening up as read only?

Related

“No cells were found.” Error in Excel 2016 when running VBA script

I’m pretty new to VBA scripting, and I have the following problem.
At work, I have to go through huge Excel sheets containing hyperlinks to external audio files. The hyperlinks are all in the following format:
=HYPERLINK("path_to_file_including_file_name", "file_name")
I’m very tired of clicking the hyperlinks with my mouse, and there is no way to open them with a hotkey, so I decided to create a small macro to solve my problem. The macro is stored in my personal macro workbook (because I want to use it with all of my Excel sheets):
Sub ClickHyperlink()
'
' ClickHyperlink Macro
' Keyboard Shortcut: Ctrl+Shift+O
'
params = Split(ActiveCell.Formula, Chr(34))
ActiveWorkbook.FollowHyperlink Address:=params(1)
End Sub
When I open an Excel sheet, this VBA macro works until I edit the file and save it. After this, it shows the following error message: “No cells were found.” If I close the file and open it again, the macro works again until I edit the file and save it.
It really doesn’t make any sense to me. What am I doing wrong?
I would be very grateful for any help.
Update. Added the screenshot of the error message and of the IDE.
I also noticed something quite strange: even when the script stops working when called from the Excel file I’m working on, it still works perfectly if run from the IDE.

Excel - Removing a Worksheet Before "Enable Content" Disables Macro's

I have a rather interesting issue in excel(Office 365 Version 1708) that seems to be affecting every file that contains Macros. If I place a untrusted XLSM file containing VBA Macro's in a untrusted location and open the file I'm greeted with the following message:
If I click "Enable Editing", I am able to edit the file but I also get the following message:
Sometime, if I delete a worksheet in the file BEFORE clicking "Enable Content"; content is not enabled. I am not able to run any VBA Macro's triggered by Custom Ribbon Events, and code in "Workbook_Open" does not trigger and does not run. To use any Macro's in the file, it needs to be closed and reopened.
Other times, I find that once you delete a worksheet, that the "Enable Content" button disappears, and again the file has to be closed/reopened to access any Macro's.
Is this intended behavior? It's very strange... Is there any way to modify this behavior to allow VBA Macro's to run after the user clicks "Enable Content", and to persist this message after the user delete's a worksheet?

Retreiving/reading excel macro without opening excel?

I wrote an excel macro that seems to have broken, unfortunately when I try to edit the macro in the VBA editor, excel itself crashes spectacularly. This seems to happen whether I open the VBA Editor before or after loading the problematic excel file.
Does anyone know of a way of viewing the VBA code that I've written without using excel to get there? Alternatively, can anyone get to the VBA code in (this excel file)(Link Removed) without it crashing their excel?
Unlike "Running Macros without opening excel" I don't need to be able to run the broken code without excel - just copy and paste it somewhere to fix it!
I created a fresh new excel file and open the VBA editor. Then I opened the one you provided, but I had put it in a non-secure folder. Excel prompted me the choice of opening it with macros disabled. I did, and I could see the code in the editor. :)

Powerpoint VBA code to appear on all new documents

I have a macro in Powerpoint 2010 to open a new document based on a template based in a central location, to be installed on several machines.
Sub PowerpointTemplate()
Application.Presentations.Open ("file")
End Sub
Powerpoint does not save the macro. Even when setting "Macro in:" to "All open presentations", it seems to reset this selection to "Presentation 1". The macro works for the time that I have this current document open, but once I close Powerpoint and reopen it, the macro has been removed.
Is there anyway to set the macro to permanently apply to all presentations?
You need to create an Add-in and load it in order to make the code available to all open presentations.
Setting Macro In to All Open Presentations simply SHOWS you the available public macros in all open presentations; it has no effect on where the macro code is saved.

Excel VBA - Call macro using add in

I have added a toolbar menu for my macro, so I can just press the button and it runs my macro from any excel document. Every time I run the macro though, it opens the source file containing the macro. Is there a way that it won't open the source file and just run the macro? (even opening and closing wouldn't too much of an issue, but I'd prefer not opening it at all)
I haven't been able to find any information about this, so all help to get me started is appreciated.
You can't pull code out of the air to run it; Excel's going to have to open the file the code's stored in to run the code.
If I understand it correctly, you can create an Excel add-in from your code and have the add-in load automatically when Excel starts. Your code will always be available in that case.
This seems like a good place to start:
http://msdn.microsoft.com/en-us/library/aa140990(v=office.10).aspx
USE YOUR PERSONAL MACRO WORKBOOK
Open the VBEditor and find the module containing your macro.
Copy that code.
Now in the VBProject Panel on the left, locate your PERSONAL.XLS or PERSONAL.XLSB project. This is the project where you store macros you want available at all times. Add a module to that project and put your code into it.
Now update your "button" so that it points to the macro in that workbook and you're good to go.
On the off chance your PERSONAL.XLS project does not exist, use the macro recorder to record a "junk" macro and be sure to set it to "Store Macro In: Personal Macro Workbook"... that will create it for you the first time.