Monday, November 29, 2010

Find the Excel Prodcut Code, Version,UseSystem Separators, Default File Path

Dim ExcelVersion as string


ExcelVersion = CreateObject("Excel.Application").ProductCode

Msgbox ExcelVersion

Dim ExcelVersion as string

ExcelVersion = CreateObject("Excel.Application").Version

Msgbox ExcelVersion

Dim ExcelVersion as string

ExcelVersion = CreateObject("Excel.Application").UseSystemSeparators

Msgbox ExcelVersion


Dim ExcelVersion as string

ExcelVersion = CreateObject("Excel.Application").DefaultFilePath

Msgbox ExcelVersion

Raise the defect from QTP

Dim TDConnection


Set TDConnection = CreateObject("TDApiOle80.TDConnection")

TDConnection.InitConnection "http://10.128.76.242:8080/qcbin" ' URL for the DB

TDConnection.ConnectProjectEx "DomainName","ProjectName","UserName","Password "

If TDConnection.Connected Then

MsgBox("Connected to " + chr (13) + "Server " + TDConnection.ServerName + chr (13) +"Project " + TDConnection.ProjectName )

'Get the IBugFactory

Set BugFactory = TDConnection.BugFactory

'Add a new empty bug

Set Bug = BugFactory.AddItem (Nothing)

Bug.field ("BG_STATUS") = "New"

' BG_RESPONSIBLE

Bug.field ("BG_PROJECT") = "Testing"

Bug.field ("BG_SUBJECT") = "Automation Testing"

Bug.field ("BG_SUMMARY") = "Automation Testing"

Bug.field ("BG_DESCRIPTION") = "QTP create the Defect Log for Automation Testing"

' BG_DEV_COMMENTS

Bug.field ("BG_SEVERITY") = "Severity 4"

Bug.field ("BG_PRIORITY") = "Low"

Bug.field ("BG_DETECTED_BY") = "UserNAme"

Bug.field ("BG_USER_01") = "Raised"

Bug.field ("BG_USER_02") = "Cycle 0"

Bug.field ("BG_USER_06") = ""

Bug.field ("BG_USER_09") = "1375484"

Bug.field ("BG_USER_10") = "SIT"

Bug.field ("BG_USER_11") = "Automation"

Bug.field ("BG_USER_12") = "Others"

Bug.field ("BG_USER_15") = "IN"

Bug.Post

Else

MsgBox("Not Connected")

End If