08-13-2008, 09:13 PM
Hi All,
The following function works fine in QTP but when i paste the same code .vbs file, it throws mismatch error and states that vbs file has an incorrect syntax
The following function works fine in QTP but when i paste the same code .vbs file, it throws mismatch error and states that vbs file has an incorrect syntax
Code:
Call SendMail("x","y","z","a","C:\a.xls")
Public Function SendMail(SendTo,SendCC,Subject,Body,Attachment)
Dim olApp
Dim olNs
Dim olMail
Set olApp = GetObject(, "Outlook.Application")
On Error GoTo 0
Set olMail = olApp.CreateItem(olMailItem)
With olMail
.To = SendTo
.CC = SendCC
.Subject = Subject
.Body = Body
.Attachments.Add(Attachment)
.Display
.Send
End With
Set olMail = Nothing
Set olApp = Nothing
End Function