Wednesday, January 14, 2009

Search for a word and replace the word with a new word then save as a different file name

'Before this script executes, you need to have a "Greetings.doc" in C drive and it contains some information. In that information each line is contains a word "Good". Now my objective is to Replace the word "Good" with "Bad". And save file with new name.
################################################################

Set Word = CreateObject("Word.Application")
Word.Visible = TRUE
Set WordDoc=Word.Documents.Open ("C:\Greetings.doc")
Do
With Word.Selection.Find
.Text = "Good"
.Replacement.Text = "Bad"
.Forward = True
.wrap=1
.Format = False
.MatchWholeWord = True
End With
Word.Documents.Application.Selection.Find.Execute
If Word.Selection.Find.Found Then
Word.Selection.Range="bad"
else
Exit Do
End If
Loop
WordDoc.SaveAS "C:\BadGreetings.doc"

QTP VB Script Trainings

Check out this SlideShare Presentation:
QTP VB Script Trainings
View SlideShare presentation or Upload your own.

QTP Shortcut Keys

Check out this SlideShare Presentation:
QTP Shortcut Keys
View SlideShare presentation or Upload your own.

Polish Your Skills For QTP Interview In MNC's

Check out this SlideShare Presentation:

How to Implement Keyword Driven Methodology in QTP

Check out this SlideShare Presentation:

QTP Descriptive Programming

Check out this SlideShare Presentation:

About Me

My photo
Hi all,I am Arun Singh Rajaputra. I am working as a Project Lead in a reputed organization in Hyderabad, AP, India. I have little bit knowledge on Quick Test Professional and like to share my knowledge to all through this blog.

Subscribe to get updates on this blog

Enter your email address:

NOTE

Some of the posts posted in this blog are collected and most of them have been prepared by me. If any one have objections regarding any copied posts. Please mail me so that I can take a necessary action on that post.