08-13-2008, 09:20 PM
Hi ,
The following function works fine in QTP but when i paste it in .vbs file it throws mismatch error and says the .vbs file has syntax errors.
How to run .vbs file
The following function works fine in QTP but when i paste it in .vbs file it throws mismatch error and says the .vbs file has syntax errors.
How to run .vbs file
Code:
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