Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Function works fine in QTP but when i put it in vbs file it throws syntax error
#1
Not Solved
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

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
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Invalid file error importing xls file Makhado 0 1,455 10-04-2018, 04:33 PM
Last Post: Makhado
  How QTP record/play works on google chrome shobi 6 7,612 01-11-2016, 09:53 AM
Last Post: vinod123
  Calling a function in a Test Script from a function library anupam4j 3 6,180 06-26-2015, 12:31 AM
Last Post: babu123
  Getting an error to open UFT using vbs file Naresh 1 5,430 06-11-2015, 06:34 PM
Last Post: venkatesh9032
  Can QTP 10 works on IE 9 with any patch? Nikhil Garg 1 2,414 02-20-2015, 11:38 AM
Last Post: vinod123

Forum Jump:


Users browsing this thread: 1 Guest(s)