Search This Blog

Monday 21 November 2016

Close Outlook Email Windows

After a busy day you may find your windows taskbar filled with many applications. Especially if, like me you find it easier not to group the labels by application. You may already have a batch file to kill all internet explorer windows, folders etc. But what about all those emails you have opened? You could close outlook and reopen. But the time it takes to reopen you might as well have gone into outlook and clicked the close all items button. The below script makes use of the 'Close all Items' button and can be tied into a bigger script to close all unnecessary windows. The script uses powershell but can be called from a BAT file for ease of execution. $outlook = new-object -com Outlook.Application $namespace = $outlook.GetNamespace("MAPI") $folder = $namespace.GetDefaultFolder("olFolderInbox") $explorer = $folder.GetExplorer() $explorer.Display() $wshell = new-object -com wscript.shell start-sleep -milliseconds 500 $wshell.Sendkeys("%(V)") $wshell.Sendkeys("C") $wshell.Sendkeys("A") $wshell.Sendkeys("%{F4}")

Friday 17 January 2014

Oracle SQL: NORMDIST Function for creating Bell Curve Charts

I had been scouring the web for a solution to find some sort of function to produce the same result as the NORMDIST Excel produces with no luck.
Therefore after decoding Microsoft's miniature equation in their help file,



I have created the below function. 

create or replace FUNCTION "NORMDIST"(
      x_VAL IN number,
      x_Mean IN number,
      x_STDEV IN number
      )
    RETURN number
  IS
    NDIST number;
  BEGIN
    
    NDIST := round((1/(sqrt(asin(1)*4)*X_STDEV))*exp(-((power((X_VAL-X_MEAN),2))/(2*power(X_STDEV,2)))),14);
    RETURN (NDIST);
    
  EXCEPTION
  WHEN OTHERS THEN
    RETURN NULL;
  END;


The function should produce the same outcome as "=NORMDIST(Val, Mean, Stdev, False)" in Excel. I don't have a degree in maths, but after testing the code it works and displays the same results. Hope it helps.

Monday 22 July 2013

Chandoo: Formula Challenge 001

For anyone who loves a challenge and thinks they have what it takes to compete against some extremely genius Excel wizards then head over to Chandoo.
The website is doing a series of excel formula challenges to melt your brain.
The first challenge (which has already finished) can be found here:
http://chandoo.org/wp/2013/07/16/formula-challenge-001-1/
But even though this challenge has finished, give it a go and see how well you can do.
Maybe you could even take the crown off Sajan. If you can I would be extremely impressed.

Thursday 4 April 2013

Outlook 2003: Exclude Flagged Emails from Archiving

I use the follow up flags a lot it my job because with all the work going in and out it is a good way to keep track of the jobs you have left to do.
So... when outlook decides to archive off half of the jobs I have yet to complete it can be a real pain.
Also I don't want to turn archiving off because I don't want my inbox cluttered with emails that are no longer relevant.

Therefore I have created a solution using VBA.
The code needs to be copied and pasted into ‘ThisOutlookSession’ which can be found by pressing ‘ALT+F11’ then expanding the folders in the project window to the left.

It works by capturing when you flag a email and automatically sets the ‘Do Not Archive’ to Ticked.


Dim myOlApp As New Outlook.Application
Public WithEvents myOlItems As Outlook.Items

Private Sub Application_Startup()
    Set myOlItems = myOlApp.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox).Items
End Sub

Private Sub myOlItems_ItemChange(ByVal Item As Object)
If Item.FlagStatus = OlFlagStatus.olFlagMarked And Item.NoAging = False Then
    Item.NoAging = True
    Item.Save
ElseIf Item.FlagStatus = OlFlagStatus.olNoFlag And Item.NoAging = True Then
Item.NoAging = False
    Item.Save
ElseIf Item.FlagStatus = OlFlagStatus.olFlagComplete And Item.NoAging = True Then
Item.NoAging = False
    Item.Save
End If
End Sub

Thursday 14 March 2013

APEX: Conditional cell formatting of a standard report

For each column, create another column with the color value you wish to pass. ( best as an HTML color code. )

select
Val,
DECODE(Val,1,'#990000',2,'#007700','#BFBFBF') Val_colour
from dual;


Hide the color column.

In the report template, in the column templates create IDs for the TDs. Ie

< td#ALIGNMENT# headers="#COLUMN_HEADER_NAME#" border="0" id="ROW_#COLUMN_HEADER_NAME#" class="data">#COLUMN_VALUE#< /td>

Then using CSS styling in the region header set these IDs to display:none
< style>
#ROW_VAL {display:none !important}
< /style>

After you have done that, you can hijack the HTML expression in the Column attributes and put in your own TD.
< td#ALIGNMENT# headers="VAL" class="data" style="background-color:#VAL_COLOUR#"> #VAL#< /td>