VB scripting

How to check the given string is a Palindrome using VB script

MyString = Ucase (Inputbox(“Enter a String:”))

RevString =strreverse(MyString)

if strcomp (MyString, RevString)= 0 then

msgbox “Given string is a  Palindrome”


msgbox “Given string is not a Palindrome”

end if

How to find the alpha characters in a string.

Dim objStr

Dim objLength

Dim objChar




For i=1 to objLength

If not isnumeric (mid(objStr,i,1)) then

alphacount =alphacount+1

alphacharacter  = alphacharacter & mid(objStr,i,1)

End if



msgbox “alpha chara count is  ” & alphacount

msgbox “alpha charaters are :   ” & alphacharacter

How to create a word document using VBscript in QTP?

Dim oWordDocument

‘ To initaiate a Word Document object

Set oWordDocument = CreateObject(“Word.Application”)


‘ type words on documents

oWordDocument.Selection.TypeText “This is 1st line text on word file ” & vbnewline & “This is 2nd line text on word file”

oWordDocument.ActiveDocument.SaveAs “C:\SampleWordDoc.doc”


Set oWordDocument=Nothing

Be the first to comment

Leave a Reply

Your email address will not be published.