Qtp Script to download attachments from outlook emails-VB Script to download attachments from outlook emails


Qtp Script to download attachments from outlook emails


Set a = CreateObject("Outlook.Application")

Set b = a.GetNameSpace("MAPI")

Set c = b.GetDefaultFolder(6)

For each item in C.Items

if item.unread then

For each att in item.attachments

FileName="C:\Email Attachments\" &att.FileName

att.saveasfile FileName

Next

End if

Next

QTP Script to read mails from inbox of outlook application-VB Script to read mails from inbox of outlook application


QTP Script to read mails from inbox of outlook application



Set a = CreateObject("Outlook.Application")

Set b = a.GetNameSpace("MAPI")

Set c = b.GetDefaultFolder(6)

For each item in C.Items

if item.unread then

msgbox item.body

End if

Next

QTP Script to get count of number of junk emails in outlook application-VB Script to get count of number of junk emails in outlook application



QTP Script to get count of number of junk emails in outlook application


Set a = CreateObject("Outlook.Application")

Set b = a.GetNameSpace("MAPI")

Set c = b.GetDefaultFolder(23)

Msgbox(C.Items.Count)

Qtp Script to add an image to Ms Word Document-Qtp Script to insert an image into MS Word Document


Qtp Script to insert an image into MS Word Document




Set a = CreateObject("Word.Application")

a.Visible = True

Set b = a.Documents.Open("C:\qtp.doc")

Set c = b.Shapes

c.AddPicture("C:\image1.JPG")

QTP Script to Find and Replace a Text in MS Word Document-Qtp Script to Replace a string in word document with another string



QTP Script to Find and Replace a Text in MS Word Document



set a=createobject("Word.Application")

a.visible=true

set b=a.Documents.open("C:\qtp.doc")

For i = 1 To b.words.Count

b.words.Item(i).Text = Replace(b.words.Item(i).Text, "Qtp", "Quick Test Pro")

Next






QTP Script to Count Number of Times a Word Appears in a Text File-VB Script to Count Number of Times a Word Appears in a Text File


QTP Script to Count Number of Times a Word Appears in a Text File



Const ForReading = 1



Set fso = CreateObject( "Scripting.FileSystemObject" )



Set textFile = fso.OpenTextFile( "C:\qtp.txt", ForReading )



contents = textFile.ReadAll



textFile.Close



Set rgxp = New Regexp



rgxp.Pattern = "QTP"



rgxp.IgnoreCase = True



rgxp.Global = True



Set matches = rgxp.Execute( contents )



Msgbox "Count = " & matches.Count

QTP Script to get type of file-VB Script to get type of file


QTP Script to get type of file



Set a = CreateObject("Scripting.FileSystemObject")

Set b = a.GetFile("C:\qtp.doc")

Msgbox b.Type



QTP Script to get size of folder-VB Script to get size of folder


QTP Script to get size of folder



Dim a,b

Set a = CreateObject("Scripting.FileSystemObject")

Set b = a.GetFolder("C:\QTP")

Msgbox b.size

QTP Script to get size of a text file-VB Script to get size of a text file


QTP Script to get size of a text file



Dim a,b

Set a = CreateObject("Scripting.FileSystemObject")

Set b = a.GetFile("C:\qtp.txt")

Msgbox b.size



Qtp script to get count of number of words in Ms Word Document-VB Script to get count of number of words in Ms Word Document



Qtp script to get count of number of words in Ms Word Document


set a=createobject("Word.Application")

 a.visible=true

set b=a.Documents.open("C:\qtp.doc")

Msgbox "Number of Words = "& b.words.count

QTP Script to append an existing text file-VB Script to append an existing text file


QTP Script to append an existing text file



set a=CreateObject("Scripting.FileSystemObject")

set b=a.OpenTextFile("C:\qtp.txt",8)

b.WriteLine "New Text Added"



QTP Script to add a new line at the beginning of a text file-QTP Script to append a new line at the beginning of a text file

QTP Script to add a new line at the beginning of a text file-QTP Script to append a new line at the beginning of a text file



Const ForReading = 1



Const ForWriting = 2



fileName = "C:\qtp1.txt"



Set fso = CreateObject( "Scripting.FileSystemObject" )



Set textFile = fso.OpenTextFile(fileName, ForReading )



contents = textFile.ReadAll



textFile.Close



firstLine = "New Line Added"



newContent = firstLine & vbCrLf & contents



Set textFile = fso.OpenTextFile( fileName, ForWriting )



textFile.WriteLine newContent





QTP Script to append an existing MS Word document at the end of document-VB Script to append an existing MS Word document at the end of document


QTP Script to append an existing MS Word document at the end of document.





set a=createobject("Word.Application")

a.visible=true

a.Documents.open("C:\qtp.doc")

a.Selection.EndKey 6,0

a.Selection.TypeText "new text added at end"

a.ActiveDocument.Save

QTP Script to Find and Replace Text in a Text File-VB Script to Find and Replace Text in a Text File


QTP Script to Find and Replace Text in a Text File



Const ForReading = 1



Const ForWriting = 2



Set fso = CreateObject( "Scripting.FileSystemObject" )



Set textFile = fso.OpenTextFile( "C:\qtp.txt", ForReading )



Text = textFile.ReadAll



textFile.Close



NewText = Replace( Text, "abc", "QTP")



Set textFile = fso.OpenTextFile( "C:\qtp.txt", ForWriting )



textFile.WriteLine NewText





QTP Script to append an existing MS Word document at the beginning of document


QTP Script to append an existing MS Word document





set a=createobject("Word.Application")

a.visible=true

a.Documents.open("C:\qtp.doc")

a.Selection.TypeText "new text added"

a.ActiveDocument.Save

QTP Script to create Sub Folder within Folder-VB Script to create Sub Folder within Folder


QTP Script to create Sub Folder within Folder



Set fso = CreateObject("Scripting.FileSystemObject")

fso.createfolder("C:\Folder")

Set fso1 = fso.createfolder("C:\Folder\SubFolder1")

Msgbox("Folder and Subfolder Created")



QTP Script to open an existing MS Word document-VB Script to open an existing MS Word document


QTP Script to open an existing MS Word document





set a=createobject("Word.Application")

a.visible=true

a.Documents.open("C:\qtp.doc")



Sorting Data in Microsoft Excel through QTP-QTP Script to Sort Data in excel sheet in Descending Order


Sorting Data in Microsoft Excel through QTP-QTP Script to Sort Data in excel sheet in Descending Order



Const xlDescending = 2

Const xlYes = 2

Set objExcel = CreateObject("Excel.Application")

objExcel.Visible = True

Set objWorkbook = objExcel.Workbooks.Open("C:\qtp.xls")

Set objWorksheet = objWorkbook.Worksheets(1)

Set objRange = objWorksheet.UsedRange

Set objRange2 = objExcel.Range("A1")

objRange.Sort objRange2,xlDescending, , , , , , xlYes

QTP Script to set the width of first column of an excel sheet-VB Script to set the width of first column of an excel sheet


QTP Script to set the width of first column of an excel sheet



dim a,b,c

set a=createobject("Excel.Application")

a.visible=true

set b=a.workbooks.open("C:\QTP.xls")

set c=b.worksheets(1)

c.Columns(1).ColumnWidth=50



QTP Script to set the Height of first row of an excel sheet-VB Script to set the Height of first row of an excel sheet

QTP Script to set the Height of first row of an excel sheet



dim a,b,c

set a=createobject("Excel.Application")

a.visible=true

set b=a.workbooks.open("C:\QTP.xls")

set c=b.worksheets(1)

c.Rows(1).RowHeight=50



QTP Script to copy one excel sheet data to other excel sheet-VB Script to copy one excel sheet data to other excel sheet


QTP Script to copy one excel sheet data to other excel sheet



Set excel=createobject("excel.application")

excel.Visible=True

Set workbook1=excel.Workbooks.Open("C:\qtp1.xls")

Set workbook2=excel.Workbooks.Open("C:\qtp2.xls")

workbook1.Worksheets("Lakshmi").usedrange.copy

workbook2.Worksheets("Sheet1").pastespecial

workbook1.Save

workbook2.Save

QTP Script to get count of unread mails in outlook-VB Script to get count of unread mails in outlook


QTP Script to get count of unread mails in outlook





Set a = CreateObject("Outlook.Application")



Set b = a.GetNameSpace("MAPI")



Set c = b.GetDefaultFolder(6)



Msgbox(c.UnreadItemCount)



QTP Script to add line numbers to MS Word document-VB Script to add line numbers to MS Word document


QTP Script to add line numbers to MS Word document



dim a

set a=createobject("Word.Application")

a.visible=true

set b=a.Documents.open("C:\qtp.doc")

b.PageSetup.LineNumbering.Active = TRUE

b.save

QTP Script to add Underlined text to MS Word document-VB Script to add Underlined text to MS Word document


QTP Script to add Underlined text to MS Word document



dim a

set a=createobject("Word.Application")

a.Documents.Add

a.visible=true

a.selection.font.size=20

a.selection.font.name="Times New Roman"

a.Selection.Font.Underline = 1

a.Selection.TypeText"HELLOOO"

a.ActiveDocument.Saveas"C:\qtp.doc"

QTP Script to Highlight First Row of an excel sheet-VB Script to Highlight First Row of an excel sheet


QTP Script to Highlight First Row of an excel sheet

dim a,b,c
set a=createobject("Excel.Application")
a.visible=true
set b=a.workbooks.open("C:\QTP.xls")
set c=b.worksheets(1)
c.Rows(1).Interior.ColorIndex= 6

QTP Script to Highlight First C0lumn of an excel sheet-VB Script to Highlight First Column of an excel sheet

QTP Script to Highlight First Column of an excel sheet


dim a,b,c
set a=createobject("Excel.Application")
a.visible=true
set b=a.workbooks.open("C:\QTP.xls")
set c=b.worksheets(1)
c.Columns(1).Interior.ColorIndex= 6

QTP Script to Highlight a cell in excel sheet-VB Script to Highlight a cell in excel sheet

QTP Script to Highlight a cell in excel sheet

dim a,b,c
set a=createobject("Excel.Application")
a.visible=true
set b=a.workbooks.open("C:\QTP.xls")
set c=b.worksheets(1)
c.Cells(1,1).Interior.ColorIndex= 6

QTP Script to change first cell font text to bold of an excel sheet-VB Script to change first cell font text to bold of an excel sheet.


QTP Script to change first cell font text to bold of an excel sheet.



dim a,b,c

set a=createobject("Excel.Application")

a.visible=true

set b=a.workbooks.open("C:\QTP.xls")

set c=b.worksheets(1)

c.Cells(1,1).Value="QTP"

c.Cells(1,1).Font.Bold=True

b.save

QTP Script to add bold text to word document-VB Script to add bold text to word document


QTP Script to add bold text to word document



dim a

set a=createobject("Word.Application")

a.Documents.Add

a.visible=true

a.selection.font.size=36

a.selection.font.name="Times New Roman"

a.selection.font.Bold=true

a.Selection.TypeText"HELLO"

a.ActiveDocument.Saveas"C:\qtp.doc"

QTP Script to Add Formatted Data to a Spreadsheet-QTP Script to change first cells font size,font name of an excel sheet


QTP Script to change first cells font size,font name of an excel sheet or QTP Script to Add Formatted Data to a Spreadsheet



dim a,b,c

set a=createobject("Excel.Application")

a.visible=true

set b=a.workbooks.open("C:\QTP.xls")

set c=b.worksheets(1)

c.Cells(1,1).Value="QTP"

c.Cells(1,1).Font.Size=16

C.Cells(1,1).Font.Name="Times New Roman"

b.save

qtp script to get name of nth worksheet of an excel sheet-vb script to get name of nth worksheet of an excel sheet


qtp script to get name of nth worksheet of an excel sheet





dim a,b

set a=createobject("Excel.Application")

a.visible=true

set b=a.workbooks.open("D:\abc.xls")

Msgbox b.sheets(1).Name

qtp script to get count of worksheets in an excel sheet-vb script to get count of worksheets in an excel sheet


qtp script to get count of worksheets in an excel sheet



dim a,b

set a=createobject("Excel.Application")

a.visible=true

set b=a.workbooks.open("D:\abc.xls")

Msgbox b.sheets.count





QTP Script to get count of number of drafts,number of sent mails,number of emails in Outbox and number of deleted items in outlook application

QTP Script to get count of number of drafts in outlook application





Set a = CreateObject("Outlook.Application")



Set b = a.GetNameSpace("MAPI")



Set c = b.GetDefaultFolder(16)



msgbox(C.Items.Count)





QTP Script to get count of number of sent mails in outlook application





Set a = CreateObject("Outlook.Application")



Set b = a.GetNameSpace("MAPI")



Set c = b.GetDefaultFolder(5)



msgbox(C.Items.Count)





QTP Script to get count of number of emails in Outbox of outlook application





Set a = CreateObject("Outlook.Application")



Set b = a.GetNameSpace("MAPI")



Set c = b.GetDefaultFolder(4)



msgbox(C.Items.Count)







QTP Script to get count of number of deleted items in outlook application





Set a = CreateObject("Outlook.Application")



Set b = a.GetNameSpace("MAPI")



Set c = b.GetDefaultFolder(3)



msgbox(C.Items.Count)

QTP Script to read the entire contents of a text file-VB Script to read the entire contents of a text file



QTP Script to read the entire contents of a text file



Dim a,b

Const ForReading = 1

Set a=CreateObject( "Scripting.FileSystemObject" )

Set b=a.OpenTextFile( "C:\qtp.txt",1)

Msgbox b.Readall



qtp script to read first few characters of a text file-vb script to read first few characters of a text file

qtp script to read first few characters of a text file



Dim a,b

Const ForReading = 1

Set a=CreateObject( "Scripting.FileSystemObject" )

Set b=a.OpenTextFile( "C:\qtp.txt",1)

Msgbox b.Read(5)

qtp script to read first line of a text file-vb script to read first line of a text file


qtp script to read first line of a text file



Dim a,b

Const ForReading = 1

Set a=CreateObject( "Scripting.FileSystemObject" )

Set b=a.OpenTextFile( "C:\qtp.txt",1)

Msgbox b.Readline

qtp script to insert blank lines into text file-vb script to insert blank lines into text file


qtp script to insert blank lines into text file



Dim a,b

Set a=CreateObject("Scripting.FileSystemObject")

Set b=a.CreateTextFile("c:\qtp.txt", True)

b.WriteLine("hiii")

b.WriteBlankLines(5)

b.WriteLine ("helloooo")

b.Close




qtp script to read last line of a text file-vb script to read last line of a text file


qtp script to read last line of a text file


Dim a,b,c

Set a = CreateObject("Scripting.FileSystemObject")

Set b = a.opentextfile("C:\qtp.txt", 1)

i = 0

Do While b.AtEndOfStream <> True

c = b.ReadLine

i = i + 1

Loop

MsgBox c

QTP Script to count number of lines in a text file-VB Script to count number of lines in a text file



QTP Script to count number of lines in a text file.



Dim a,b

Const ForReading = 1

Set a=CreateObject( "Scripting.FileSystemObject" )

Set b=a.OpenTextFile( "C:\qtp.txt",1)

b.ReadAll

Msgbox "Number of lines= " & b.Line

Related Posts Plugin for WordPress, Blogger...

Fun and Knowledge