Notifications from Excel file modification - excel

do someone know if it's possible to execute a VBA code that send an email or windows notification when someone modifies, add a line for example or any modification. I want to use it for a file that help us to do regular check on the number of contracts delivered. So everytime someone types a new line, I can see it and put it on my own check file.

The Worksheet.Change event is what you want. In short, whenever one of a certain type of change is made to the worksheet, this code is run. You can read more about it on the documentation page here:https://learn.microsoft.com/en-us/office/vba/api/excel.worksheet.change

Related

Power Automate - Infinite Loop issue

This sounds so simple in my head, but Power Automate doesn't like it.
I have a library with a lookup column. I have a Flow created which takes the filename of the document and puts this name into a "Title" column. Then I can use a lookup column on the Title column to find all the files in the library.
I've used "When a file is created or modified". Yet this flow runs constantly. No files are being update or modified at 1am, yet it still runs over and over. I've had an automated email telling me to fix this before it is disabled.
All I want it to do is run the damn flow ONLY when a file is updated or uploaded, just as its own function title suggested.
It would seem I need to add trigger rules, but all the guides I found were talking about checking if a specific person has modified it.
This used to be so simple with workflows, it would only run if something was modified or uploaded.

Using modules from a specific excel file in files generated from said specific one

Tl;dwtr: General file with macro's, one to create duplicate (a Project), one to send automated mail to request stuff. Last one opens general file and is not using the duplicated in which I clicked said macro.
In my work I create loads of 'Projects' from one general excel sheet. These projects have specified information stored in them. At the moment I can make a duplicate form the general file en store this with names dates info etc.
Problem being, I wrote a macro in the general file, which uses the specified info and sends automated emails to request some type of file bases on the info. Now when I do this (use the macro inside the duplicated file) it opens the general file and uses the leftover info which is still there at the moment.
My guess is that the modules are somehow linked to a certain xls file, but im not sure nor experienced enough to figure it out. I hope some of you can help me out.

Keep custom functions aligned with their source files

In this link, it says that
During development and testing, you can manually clear your computer's cache of registration metadata by deleting the folder <user>\AppData\Local\Microsoft\Office\16.0\Wef\CustomFunctio‌​ns.
I then make a test as follows:
I load a manifest.xml pointing to the original customfunctions.js in my server in a workbook. After closing the workbook, a file is automatically saved in ...\Wef\CustomFunctio‌​ns\V1.
I modify manually customfunctions.js in my server by replacing Excel.Script.CustomFunctions["CONTOSO"]["ADD42"] by Excel.Script.CustomFunctions["CONTOSO"]["ADD42NEW"].
I open a new workbook, in a cell, after enter =contoso., the IntelliSense shows me contoso.add42 rather than add42new. After entering =contoso.add42(5;4), the cells shows #GETTING_DATA and does not return a value. That's understandable because it works on a function which does not exist anymore.
If we click on another cell and enter e.g., =2+3, we see the workbook is refreshed, and #GETTING_DATA becomes #NAME?. And now IntelliSense shows contoso.add42new rather than contoso.add42.
To conclude, I think there may be a bug: when we open a workbook, IntelliSense should give the updated list of custom functions defined in the current customfunctions.js.
Actually, what is ideal is that the custom functions in workbook always keep aligned with what are defined in customfunctions.js. If there was not this bug, today we still needed to close a workbook and reopen one to get updated. Does anyone know if there is a workaround to make custom functions in an opened workbook keep updated on the fly? Is there a refreshing trigger that allows us to make custom functions in an opened workbook update from the current customfunctions.js?
Thanks for the question! As you've discovered, custom function definitions are currently updated only on-demand rather than on every single document-open event.
We've received a bunch of feedback in this area and so we're considering some changes to how registration works so that the list of functions in IntelliSense/autocomplete gets updated at the beginning of a session instead of in the middle of one.
I don't have details to share right now, but be on the lookout for some changes here in a few months.

Is it possible to store reusable VBA code in a library and call from Outlook?

I have code written in Outlook 2010 VBA that I want to share with co-workers (an Outlook rule runs that calls the code, which saves the current e-mail to a network folder as a text file). What I would like to do is save the VBA code in a library somewhere on the network, and have Outlook call it there. This way, others can call the same code and there is one set of code that all instances of Outlook can point to. If you can point me to info on setting this up I would appreciate it!
I do a similar thing in VBscript programs, using executeglobal to basically run a file containing the functions (acts like an include file) and am looking for how to do it in VBA.
Well it seems its not as easy as I was hoping. After perusing the links supplied by MP24 (Thanks MP24!), I learned the Outlook OTM file is not really intended to be shared. It errored for a colleague when I saved it to a network drive and she tried to use it via tools/references. To share code, one can export it as a .bas file, and another user can import it. This will add it to their own code if some exists already. The proper way seems to be to write an add-in, but that is beyond the scope of what I need for what I am doing. So, if a colleague wants to use my code I'll export and they can import it. The trouble is if I change something they will have to delete it and re-import. Oh well.

Applescript to capture result of close dialog

How does one capture a "Don't Save" or "Save" response to the Standard Suite "close" dialog?
try
close front document saving ask
on error
return
end try
returns "error number -10000" if the user selects "Cancel", so that case is handled.
However, subsequent code depends on whether "Don't Save" or "Save" was selected.
Thanks
UPDATE
Using regulus's answer and it's workaround strategy, I prefaced the code above with
tell application "Finder" to set _modDateAfterSaveDialog to
modification date of (info for file _filename)
where the _filename was assigned earlier from application-specific AS code.
Analogous code and a test followed the "try".
I really have no idea how to get it directly. I assume the command you are issuing is a specific application command, not a standard suite command because standard applescript doesn't have a "front document".
In any case, here's a work-around idea that might work. When a file is saved its modification date changes. So you need to know the file of the front document. Then you just check the modification date of the file before and after you issue this command. If it changed then you know the file was saved.
Good luck.

Resources