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



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


Set a = CreateObject("Outlook.Application")

Set b = a.GetNameSpace("MAPI")

Set c = b.GetDefaultFolder(6)

msgbox(C.Items.Count)

qtp script to get message box text in 2 lines-vb script to get message box text in two lines



qtp script to get message box text in two lines


MsgBox ("Hi" & vbCrLf & "Hello")


Output-

Hi
Hello






QTP Script to display Message Box Text in Multiple Lines-VB Script to get message box text in multiple lines



qtp script to get message box text in multiple lines


MsgBox ("Line1" & vbCrLf & "Line2" & vbCrLf & "Line3" & vbCrLf & "Line4" & vbCrLf & "Line5")


Output -

Line1
Line2
Line3
Line4
Line5

QTP Script to get version of Outlook-VB Script to get version of Outlook


QTP Script to get version of Outlook

dim a
set a=createobject("Outlook.Application")
Msgbox(a.version)

QTP Script to open Outlook -VB Script to open Outlook



QTP Script to open Outlook

dim a,b,c
Set a = CreateObject("Outlook.Application")
Set b = a.GetNamespace("MAPI")
Set c=b.GetDefaultFolder(3)
c.Display
Msgbox("Outlook Opened")

QTP Script to sort excel sheet column-VB Script to sort excel sheet column



QTP Script to sort excel sheet column

dim a,b,c,d
set a=createobject("Excel.Application")
a.visible=true
set b=a.workbooks.open("D:\abc.xls")
set c=b.worksheets(1)
set d=c.usedrange
d.sort(d)

QTP Script to delete first two columns data of excel sheet-VB Script to delete first two columns data of excel sheet


QTP Script to delete first two columns data of excel sheet

dim a,b,c,d
set a=createobject("Excel.Application")
a.visible=true
set b=a.workbooks.open("D:\abc.xls")
set c=b.worksheets(1)
c.Columns("A:B").Delete

QTP Script to copy one worksheet data of Excel Sheet to other worksheet-VB Script to copy one worksheet data of Excel Sheet to other worksheet



QTP Script to copy one worksheet data of Excel Sheet to other worksheet


dim a,b
set a=createobject("Excel.Application")
a.visible=true
set b=a.workbooks.open("D:\abc.xls")
b.sheets("sheet1").Copy,b.Sheets(1)
b.save

Creats copy of sheet1 in new excel worksheet

QTP Script to Change(Move) worksheets position of Excel Sheet-VB Script to Change(Move) worksheets position of Excel Sheet



QTP Script to Change(Move) worksheets position of Excel Sheet

dim a,b,c
set a=createobject("Excel.Application")
a.visible=true
set b=a.workbooks.open("D:\abc.xls")
b.sheets("sheet1").Move,b.Sheets(2)
b.save

QTP Script to delete top two rows of excel sheet-VB Script to delete top two rows of excel sheet-QTP-Excel Sheet



QTP Script to delete top two rows of excel sheet

dim a,b,c
set a=createobject("Excel.Application")
a.visible=true
set b=a.workbooks.open("D:\abc.xls")
set c=b.worksheets("sheet1")
c.rows("1:2").delete
b.save

QTP Script to delete worksheet of Excel Sheet-VB Script to delete worksheet of Excel Sheet-QTP Scripts-Excel Sheet

QTP Script to delete worksheet of Excel Sheet

dim a,b
set a=createobject("Excel.Application")
a.visible=true
set b=a.workbooks.open("D:\abc.xls")
b.Sheets("lax").delete
b.save

QTP Script to rename Excel Worksheet-VB Script to rename Excel Worksheet-QTP-Excel Sheet-Excel Sheet-QTP

QTP Script to rename Excel Worksheet

dim a,b
set a=createobject("Excel.Application")
a.visible=true
set b=a.workbooks.open("D:\abc.xls")
b.worksheets(1).name="lax"
b.save

QTP Script to add new worksheet to Excel Sheet -VB Script to add new worksheet to Excel Sheet-QTP -Excel Sheet

QTP Script to add new worksheet to Excel Sheet

dim a,b,c
set a=createobject("Excel.Application")
a.visible=true
set b=a.workbooks.open("D:\abc.xls")
set c=b.sheets.add
b.save

QTP Script to send mails from outlook to multiple persons-QTP Script to send mails from outlook to more than one person-QTP Scripts

QTP Script to send mails from outlook to more than one person


dim a,b
set a=createobject("Outlook.Application")
set b=a.createitem(0)
b.to="lakshmi@abc.com"
b.cc="lak@xyz.com"
b.bcc="lax@aaa.com"
b.subject="hello"
b.body="hiiiii"
b.send
MsgBox("Mail Sent To All")

QTP Script to send email with an attachment through Outlook-VB Script to send email with an attachment from Outlook

QTP Script to send email with an attachment from Outlook


dim a,b
set a=createobject("Outlook.Application")
set b=a.createitem(Mail)
b.to="abc@xyz.com"
b.subject="hello"
b.body="hiiiii"
b.attachments.add"C:\Documents and Settings\lakshmi\Desktop\qtp.txt"
b.send

QTP Script to close Outlook-VB Script to close Outlook-QTP and Outlook-VB Script and Outlook

QTP Script to close Outlook


First Open Outlook and run the below script


dim a

set a=createobject("Outlook.Application")

a.quit

MsgBOx("Outlook Closed")

QTP Script to send mail from outlook-VB Script to send mail from outlook

QTP Script to send mail from outlook


dim a,b
set a=createobject("Outlook.Application")
set b=a.createitem(Mail)
b.to="lakshmi@abc.com"
b.subject="hello"
b.body="hiiiii"
b.send

Qtp Script to display Time in different formats-VB Script to display Time in different formats

Qtp Script to display Time in different formats

Dim a
a=FormatDateTime(Now(),vbLongTime)
MsgBox(a)

Output-4:33:08 PM



Dim a
a=FormatDateTime(Now(),vbShortTime)
MsgBox(a)

Output-16:33

QTP Script to display date in different formats-VB Script to display date in different formats

QTP Script to display date in different formats


Dim a
a=FormatDateTime(Date(),vbGeneralDate)
MsgBox(a)

Output-8/8/2012



Dim a
a=FormatDateTime(Date(),vbLongDate)
MsgBox(a)

Output-Wednesday, August 08, 2012



Dim a
a=FormatDateTime(Date(),vbShortDate)
MsgBox(a)

Output-8/8/2012

QTP Script To Get Abbreviated Name of Current Month-VB Script To Get Abbreviated Name of Current Month

QTP Script To Get Abbreviated Name of Current Month



Dim a
a=MonthName(Month(Date),True)
MsgBox(a)

Output-Aug

QTP Script To Get Abbreviated Name of Month-VB Script To Get Abbreviated Name of Month

QTP Script To Get Abbreviated Name of Month


Dim a
a=MonthName(1,true)
MsgBox(a)

Output-Jan

Dim a
a=MonthName(2,true)
MsgBox(a)

Output-Feb

QTP Script To Get Abbreviated Name of Current Weekday-VB Script To Get Abbreviated Name of Current Weekday

QTP Script To Get Abbreviated Name of Current Weekday


Dim a

a=WeekDayName(Weekday(date),true)

MsgBox(a)


Output-Wed

QTP Script To Get Abbreviated Name of Weekday-VB Script To Get Abbreviated Name of Weekday

QTP Script To Get Abbreviated Name of Weekday

Dim a
a=WeekDayName(1,true)
MsgBox(a)

Output-Sun

Dim a
a=WeekDayName(2,true)
MsgBox(a)

Output-Mon

QTP Script to Get Last Modified Date and Time of a Folder-VB Script to Get Last Modified Date and Time of a Folder

QTP Script to Get Last Modified Date and Time of a Folder-VB Script to Get Last Modified Date and Time of a Folder

How to get Last Modified date and time of a particular folder?



Dim a,b,c

Set a = CreateObject("Scripting.FileSystemObject")

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

c= "Folder was Last Modified on: " & b.DateLastModified

MsgBox(c)

QTP Script to Get Accessed Date and Time of a Folder-VB Script to Get Accessed Date and Time of a Folder

How to get Last Accessed date and time of a particular folder?



Dim a,b,c

Set a = CreateObject("Scripting.FileSystemObject")

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

c= "Folder was Accessed last on: " & b.DateLastAccessed

MsgBox(c)

QTP Script to Get Created Date and Time of a folder-vb script to get Created Date and Time of a folder

QTP Script to get folder created time


Dim a,b,c

Set a = CreateObject("Scripting.FileSystemObject")

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

c= "Folder was Created on: " & b.DateCreated

MsgBox(c)


above script displays created date and time of qtp folder,which is in C Drive.

QTP Script to delete folder-VB Script to delete folder in system-Delete Folder QTP Script-QTP File System Object

dim a

set a=createobject("scripting.filesystemobject")

a.deletefolder("d:\\xyz")

MsgBox("Folder Deleted")

Related Posts Plugin for WordPress, Blogger...