Archive for the ‘VBA’ Category

Sample Module to read from Outlook:

Option Explicit

Public Sub OutlookSpeak()

Dim OutApp As Outlook.Application
Dim Namespace As Namespace
Dim Fold As MAPIFolder
Dim szStr As String
Dim MailItems As Variant

Set OutApp = CreateObject(”outlook.application”)
Set Namespace = OutApp.GetNamespace(”MAPI”)
Set Fold = Namespace.GetDefaultFolder(olFolderInbox)

For Each MailItems In Fold.Items

szStr = MailItems.Body
On Error Resume Next
Application.Speech.Speak szStr
szStr = “”

Next MailItems

Application.Speech.Speak “All messages have been read.”

End Sub

Set fs = CreateObject(”Scripting.FileSystemObject”)

If (fs.FileExists(”Full file path”)) Then

i = MsgBox(”File exists !!!”, vbInformation, “File Check”)
Else
i = MsgBox(”File Path Failed !!!”, vbInformation, “File Check”)
End If