Jammed up Office Mailbox – No more!

If you were like me, who always receive emails from colleagues with huge attachments (and I meant HUGE, the largest I ever received was a 10MB PowerPoint slide), you probably can understand my frustration. Every other week my mailbox will be cloaked up, and I have to clear my inbox before I can send out emails. It didn’t help that our IT admin only allocated each of us with only a pathetic 200MB mailbox quota (in this world where free mailboxes in gigabytes are not uncommon).

I don’t like to move those huge files to a local mail folder for a couple of reasons. So I came up with a method of manually save and delete the attachments, before inserting the links of the attachments into the original email. It worked well, but it is very manual. Outlook 2010 does help to simplify some of these steps, but the ‘solution’ was still very manual. I had always wanted to do a quick macro programming to simplify these steps, but too lazy to move my butt.

A message with the option to archive the attachments

Earlier, I was again spending my Saturday afternoon clearing up my mailbox. I thought enough is enough so I went to google some samples, and existing solutions so that I can get this problem nailed once and for all. (Power of internet!)

There isn’t one solution that fits my need entirely, but suffice to say, I have enough information from the net to build a version 1.0 of what I need within minutes. Here’s a quick re-collection of what I have done;

  1. First of all, I need to enable macro in my Microsoft Outlook. Customize Quick Access Toolbar > Customize Ribbon > Enable “Developer” tab under “Main Tabs”
  2. At the Developer Tab (in the main application screen), Create a new macro by navigating to Macros > Enter a new name > Create
  3. In the macro program, I create a subroutine that will loop through the the attachments in the email, archive each of them by exporting and deleting, and finally insert the exported attachment links into the message body of the original email. The code, which is leveraged from the net with some modification, can be found at the end of this blog post.
  4. Then I add the macro shortcut to the message window’s “Ribbon Bar”, so that I can “run” it immediately any time while reading an email.
    1. Open the message window by clicking on any of the emails.
    2. Go to Customize Quick Access Toolbar > Customize Ribbon
    3. Under “Choose commands from”, select Macros. The newly created macro should be in the list
    4. Under “Customize Ribbon”, Select Main Tabs.
    5. Create a new tab, and under the new tab that I have just created, create a new group. The new macro command has to be added under this new group. Rename the tab and the group where appropriate. I name them as “My Tab” and “Quick Stuff” respectively.
    6. Select the newly created macro and add it to the new group. I named the macro “Save & Link Attachment”
  5. Once I have done all the above, I can now open any email with an attachment, Click on “My Tab” and then “Save & Link Attachment” (or whatever you named it earlier in 4(vi)), the attachment will be saved, deleted and subsequently linked in the email automatically!


How a message looks like after the macro processing

Here is the subroutine that checks for attachments existence before doing the necessary file and messaging operations. If you want your attachment(s) to be saved in specific folder (and its sub folder), you can always modify the value of the variable strFolderpath
Sub SaveAttachment()

Dim objOL As Outlook.Application
Dim objMsg As Outlook.MailItem 'Object
Dim objAttachments As Outlook.Attachments
Dim objSelection As Outlook.Selection
Dim i As Long
Dim lngCount As Long
Dim strFile As String
Dim strFolderpath As Variant
Dim strDeletedFiles As String

    ' Get the path to your My Documents folder
    'strFolderpath = CreateObject("WScript.Shell").SpecialFolders(16)
    'On Error Resume Next
    ' Instantiate an Outlook Application object.
    Set objOL = CreateObject("Outlook.Application")
    ' Get the collection of selected objects.
    Set objSelection = objOL.ActiveExplorer.Selection
    ' Set the Attachment folder.
    'strFolderpath = strFolderpath & "\OLAttachments\"
    'Use the MsgBox command to troubleshoot. Remove it from the final code.

    strFolderpath = "C:\"  

    Dim MyPath As Variant
    MyPath = BrowseForFolder(strFolderpath)
    If VarType(MyPath) = 11 Then
      If Not MyPath Then
        GoTo ExitSub
      End If
    End If
    strFolderpath = MyPath

    ' Check each selected item for attachments. If attachments exist,
    ' save them to the Temp folder and strip them from the item.
    For Each objMsg In objSelection
    ' This code only strips attachments from mail items.
    ' If objMsg.class=olMail Then
    ' Get the Attachments collection of the item.
     Set objAttachments = objMsg.Attachments
     lngCount = objAttachments.Count
    'Use the MsgBox command to troubleshoot. Remove it from the final code.
    'MsgBox objAttachments.Count
     If lngCount > 0 Then
    ' We need to use a count down loop for removing items
    ' from a collection. Otherwise, the loop counter gets
    ' confused and only every other item is removed.
        For i = lngCount To 1 Step -1
        ' Save attachment before deleting from item.
        ' Get the file name.
        strFile = objAttachments.Item(i).FileName
        ' Combine with the path to the Temp folder.
        strFile = strFolderpath & "\" & strFile

        'MsgBox strFile

        ' Save the attachment as a file.
        objAttachments.Item(i).SaveAsFile strFile
        ' Delete the attachment.
        objAttachments.Item(i).Delete
        'write the save as path to a string to add to the message
        'check for html and use html tags in link
        If objMsg.BodyFormat <> olFormatHTML Then
            strDeletedFiles = strDeletedFiles & vbCrLf & "<file:>"
            Else
            strDeletedFiles = strDeletedFiles & "<br>" & "<a href='file://" & _
            strFile & "'>" & strFile & "</a>"
        End If
        'Use the MsgBox command to troubleshoot. Remove it from the final code.
        'MsgBox strDeletedFiles
        Next i
    End If
    ' Adds the filename string to the message body and save it
    ' Check for HTML body
    If objMsg.BodyFormat <> olFormatHTML Then
        objMsg.Body = "The file(s) were saved to " & strDeletedFiles & vbCrLf & vbCrLf & objMsg.Body
    Else
        objMsg.HTMLBody = "<p><p>The file(s) were saved to " & strDeletedFiles & "</p></p>" & objMsg.HTMLBody
    End If
       objMsg.Save
    'End If
    Next
ExitSub:
Set objAttachments = Nothing
Set objMsg = Nothing
Set objSelection = Nothing
Set objOL = Nothing

End Sub

I also added a function to select the folder where I want the attachment(s) to be saved in and referenced from (the message)

Function BrowseForFolder(Optional OpenAt As Variant) As Variant
     'Function purpose:  To Browser for a user selected folder.
     'If the "OpenAt" path is provided, open the browser at that directory
     'NOTE:  If invalid, it will open at the Desktop level

    Dim ShellApp As Object

    'Create a file browser window at the default folder
    Set ShellApp = CreateObject("Shell.Application"). _
    BrowseForFolder(0, "Please choose a folder to save the attachment(s)", 0, OpenAt)

     'Set the folder to that selected.  (On error in case cancelled)
    On Error Resume Next
    BrowseForFolder = ShellApp.self.Path
    On Error GoTo 0

     'Destroy the Shell Application
    Set ShellApp = Nothing

     'Check for invalid or non-entries and send to the Invalid error
     'handler if found
     'Valid selections can begin L: (where L is a letter) or
     '\\ (as in \\servername\sharename.  All others are invalid
    Select Case Mid(BrowseForFolder, 2, 1)
    Case Is = ":"
        If Left(BrowseForFolder, 1) = ":" Then GoTo Invalid
    Case Is = "\"
        If Not Left(BrowseForFolder, 1) = "\" Then GoTo Invalid
    Case Else
        GoTo Invalid
    End Select

    Exit Function

Invalid:
     'If it was determined that the selection was invalid, set to False
    BrowseForFolder = False

End Function

Boutique Store, Hypermarket and Farmer’s Market

When Microsoft first launched their Application Marketplace, the number of applications are so limited that you feel like entering a boutique shop selling or showcasing limited edition products.

After 3 years (or is it 4?), Apple (and their loyal fans) always like to boast about the high volume of applications available in their Appstore. The last I read they claimed to have 200,000 applications available for download. But in reality, how many of them are really useful, and how many of them would really catch your attention for a download? Apple Appstore therefore is like a big superstore or hypermarket, not just  because there’s a wide variety of products you can choose from, but more importantly you are either clueless what exactly you need, or you are just bored that you want to shop around.

Now Google had recently claimed that they have reached the milestone of 75000 apps in their Android market. With just 1/3 of what Apple Appstore has,  Android market is just like a farmer’s market (or in local context, a wet market), provides all the essential and necessity goods without the bells and whistles.  Android Market is just that for the current moment. But like a typical wet market, it’ll transform overtime, and I will not be surprised that Android Market becomes a “superstore” in near future.

So the point being? Application store in terms of application counts is no longer relevant anymore. What  matters more will be the quality of the applications available, and that is not just about the user interface, but also the functionalities the application provides. Strip away the useless apps in Apple Appstore for example, you probably only have 1/3 (I am being conservative here) of them that’s worthy for download and use. So keep an open mind (myself included), ask yourself what applications you need, and shop around to see which platform offers the best application that best meets your need, not how many you can download.

Merlion NG v1.61 creates its own milestone

Ever since I started building the new series of Merlion Leo ROM, I started to see more interest probably because it’s based on the new Windows Mobile 6.5 platform. Lately, I have updated the ROM with newer version of drivers and the necessary configurations,  and that  was a huge performance booster!

There must be some correlation between the number of clicks the ROM download link got, versus the performance of the ROM. Within 2 days of release, it got more than 200 of clicks. Okay, not a great deal for the mainstream  ROMs like Miri or Energy, or the actual download is approximately just 3/4 of of the clicks. Regardless,that’s a significant milestone for Merlion NG series in my humble opinion.

The demographic of my user base is pretty much expected. Since I have build the Chinese Simplified Input/Display support, I would naturally anticipate most of the users to come from a Chinese populated location. So users from Singapore & China made up close to 60% of Merlion NG series total user base. What’s interesting is I do have users from the Europe & Middle East countries.

If you have not flashed the latest Merlion NG series ROM (v1.65), you should because you never know what you have been missing until you have tried it. Some had even described the ROM to be on steroid,  or on drug cocktail!  Don’t believe? See the below performance chart of the NG series ROM performance.

If the chart above does not give you much context, just imagine this. A stock (i.e. official) ROM would only achieve a total SPB benchmark index of 1590. In comparison to the latest release of Merlion NG series, the latter is 2 times faster! Even for the first generation of Merlion series, v2.68 is generally one of the better performing ROM among the rest of HD2 custom ROMs, so I will not be surprised, if we were to put a ranking table to compare the performance of all the custom ROMS in xda-developers or htcpedia, Merlion NG series should be in the top ranks, if not right at the top 😉

Cooking Windows Mobile ROM for dummies

Introduction to cooking

We are all very familiar with setting up a new operating system in our PC or notebook. Doing so on our Windows mobile device, is however, not so straight forward. The only way is to setup the operating system, along with the desired applications, into an image, which will then be flashed into the mobile device. The process of building the image, is also known as cooking.  The person who involves in cooking, is known as chef.

Continue reading

Venturing into ROM cooking

And I meant ROM as Read-Only-Memory, not Registry-of-Marriage, which some fellow Singaporean bloggers would have assumed 😀

Despite holding a non-development responsibility in my IT professional job, I still have a soft spot for software programming, and therefore, I have been developing software during my free time, and some of them were showcased in my own blog


The year of 2010, is a new era for me, as I have “progressed” beyond software development, and ventured into Windows Mobile operating system image development, or better known as “ROM cooking”, and greatly helped by the availability of easy-to-use tools.

dZenkinZ © Merlion Leo is my first attempt of the ROM building venture, for HTC HD2 Leo. The primary objective of the effort is to have a customized ROM based on my personal needs, with the emphasis on striking a balance between performance and nice user interface. So you may find that some of the included/excluded features not something you would expect of a “public ROM”. Nevertheless, recognising that this is probably the first Leo ROM that’s based on WWE (WorldWide Edition, i.e. English ROM) with Simplified Chinese display & input support, I have decided to share my work with you so that this provides an alternative to rest of the ROMS out in xda-developers.

And why Merlion as the name of my ROM? Since this is possibly the first made-in-Singapore Leo ROM, and Merlion is a well recognised icon for Singapore, I thought why not? It surely beats using some other geeky or cheesy name, isn’t it?

If you like to use my ROM, you can head over to xda-developers for the download link and discussion.

ShowTraffic with Google Map Traffic

ShowTraffic SG has been updated to release 1.2. It fixes some bugs, and introduce a new feature to support Google Map Traffic, which enables one to go directly to Google Map from Show Traffic application.

You can download from here Update on 28th Jan: version 1.3 has been released to fix a bug and also added two new camera points.