Friday, February 27, 2009

Free SQL code formatting tools

If you are T-SQL developer, go grab this tools. It’s a SQL code formatting plug-in for SQL Server Management Studio. Previously I am using Java based code formatting tools but this one integrated with Management Studio is far better.

The tools is called ApexSQL Refactor, published by ApexSQL. Give it a try it is free.

Code formatting give you better readabilities to the code. Below sample of Before and After.

Download from the official site at this link.

Wednesday, February 25, 2009

Auto BCC in Outlook 2007

Recently I decided to combine my Internet Email with my office Microsoft Exchange Email. This work beautifully except now I lost the features of auto bcc all email I sent out to my GMail account. This is available in Thunderbird not not available in Outlook 2007. I wish Microsoft can have this in the Rules. Anyhow below is how I setup my Multi Account some VBA to perform the Auto BCC.

In Outlook 2007. Click Tools –> Settings the use the wizard to add a new Account. For better management I create a new pst (Outlook Data File) to store email for this particular account. Just click Change Folder button to assign all email from the second account to this pst file. IMO cleaner and neater.

After you had setup the second email account and tested working correctly it’s time to add in the VBA Code to auto BCC. You may refer to this link on how to do it. Based on the sample code I did some changes to only bcc my email for specific account. Below is the modified version.

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim objRecip As Recipient
Dim strMsg As String
Dim res As Integer
Dim strBcc As String
On Error Resume Next

If Item.SendUsingAccount = "<Outlook EMail Account Setting Name>" Then
strBcc = "someone@example.com"

Set objRecip = Item.Recipients.Add(strBcc)
objRecip.Type = olBCC
If Not objRecip.Resolve Then
strMsg = "Could not resolve the Bcc recipient. " & _
"Do you want still to send the message?"
res = MsgBox(strMsg, vbYesNo + vbDefaultButton1, _
"Could Not Resolve Bcc Recipient")
If res = vbNo Then
Cancel = True
End If
End If
Set objRecip = Nothing
End If
End Sub

To get rid of the Security message you need to sign the code using personal certificate. Refer to this link.

Lastly you may asked why I need to bcc my email. Well I used gmail to backup my company email so in order to maintain a full correspondence record all email reply on my PC (aka Outlook 2007) need to stored a copy in gmail.

Wednesday, February 18, 2009

ActiveSync Support Code: 1

Having ActiveSync problem for my WinMo and XP for many months, finally got it solved. Below are the solution which I Google.

Click Start > Run and type the following: Regsvr32.exe %Windir%\System32\ole32.dll