Posts Tagged vbscript

Modify Outlook 2007 View by using vbscript (vbs)

Currently I am checking how to modify Outlook 2007 default view by using vbs.

Following is my working vbs. You can download and test it.

MSDN reference:
http://msdn.microsoft.com/en-us/library/bb177050.aspx

VBS code example

Const ForReading = 1
Const olFolderInbox = 6
Const olColorRed = 10
Set olApp = CreateObject("Outlook.Application")
Set objName = olApp.GetNameSpace("MAPI")

Set objTableView = objName.GetDefaultFolder(olFolderInbox).CurrentView

            objTableView.ColumnFont.Size = 10
            objTableView.ColumnFont.Name = "Arial"

            objTableView.RowFont.Size = 10
            objTableView.RowFont.Name = "Arial"

            objTableView.AutoPreviewFont.Name = "Arial"
            objTableView.AutoPreviewFont.Size = 10

            ' Save the table view.
            objTableView.Save
            objTableView.Apply

        Set objView = objName.GetDefaultFolder(olFolderInbox).CurrentView

        For Each objRule In objView.AutoFormatRules

           If Not objRule.Name = "Unread group headers" Then

                'MsgBox objRule.Name
		'MsgBox objRule.Font.Color

                objRule.Font.Color = olColorRed

           End If
           objRule.Font.Size = 10
           objRule.Font.Name = "Arial"

        Next

        objView.Save
        objView.Apply

wscript.echo "Completed"

Outlook 2007 default view

Outlook 2007 default view

Outlook 2007 default view

After running vbs, it makes the following change
1. Font changed from Segoe to Arial
2. Font size changed to 10pt
3. Unread mail changed from black to red

After running vbs, modified Outlook view

After running vbs, modified Outlook view

VN:F [1.9.18_1163]
Rating: 0.0/5 (0 votes cast)
VN:F [1.9.18_1163]
Rating: 0 (from 0 votes)
Total views: 22,731 views

, , , ,

1 Comment

SAPI vbscript example

This VBScript example provides a simple text-to-speech demonstration by using SAPI and VBScript.

Very interesting :)

Download this text file and rename it to SAPI_Speak.vbs.

Double click and run it. Your computer will speak out what you have entered.
* Remember to turn on your speaker.

File: SAPI_Speak.txt

'********************************************
'* Windows SAPI VBScript Example
'* Author: Victor Tong
'* Website: www.0101news.com
'* Last Update: 22 June, 2009
'********************************************

Dim message, sapi
message=InputBox("Enter a string that you want SAPI to speak")
Set sapi=CreateObject("sapi.spvoice")
sapi.Speak message
VN:F [1.9.18_1163]
Rating: 5.0/5 (2 votes cast)
VN:F [1.9.18_1163]
Rating: +1 (from 1 vote)
Total views: 21,852 views

, ,

3 Comments