Highlighted
Knowledge Partner Knowledge Partner
Knowledge Partner
149 views

VBA Error : Activex Component can't create object

Hi All,

 

Below VB Vuser Type Script is perfectly running from Vugen 11 Patch 4.

 

But while I attempted to run the same script from LoadRunner 11 or Performance Center 11,  I am recieving VB error message.

 

"VBA Error : Activex
Component can't create object"

 

Public Function Action() As Long
    Dim td
    td = objectHelper.CreateObject("TDApiOle80.TDConnection.1")
    td.InitConnectionEx("http://almdev/qcbin")
    lr.start_transaction("ALM_ExportDefects_Login")
    td.ConnectProjectEx("DOMAIN_NAME", "PROJECT_NAME", "USER_NAME", "PASSWORD")
    lr.end_transaction("ALM_ExportDefects_Login", lr.PASS)
    lr.output_message("Login successful")
    Dim bugFactory As TDAPIOLELib.BugFactory
    Dim bugList As TDAPIOLELib.List
    Dim bugListcount
    bugFactory = td.BugFactory
    bugList = bugFactory.NewList("")
    bugListcount = bugList.count
    lr.output_message("The total number of defects is " + CStr(bugListcount))
    Dim objExcel, strExcelPath, objSheet, strFileName
    strFileName = "C:\Temp\" + "DefectFile" + lr.eval_string("<FileName1>") + ".xls"
    objExcel = CreateObject("Excel.Application")
    objWorkbook = objExcel.Workbooks.Add()
    objWorkbook.SaveAs(strFileName)
    lr.output_message(" The path of excel sheet is " + CStr(strFileName))
    objExcel.WorkBooks.Open(strFileName)
    objSheet = objExcel.ActiveWorkbook.Worksheets(1)
    Dim Row
    Row = 2
    objSheet.Cells(1, 1).Value = "BG_BUG_ID"
    objSheet.Cells(1, 2).Value = "Bug.Summary"
    objSheet.Cells(1, 3).Value = "Bug.DetectedBy"
    objSheet.Cells(1, 4).Value = "Bug.Priority"
    objSheet.Cells(1, 5).Value = "Bug.Status"
    objSheet.Cells(1, 6).Value = "Bug.AssignedTo"
    lr.start_transaction("ALM_ExportDefects_Export")
    For Each Bug In bugList
        objSheet.Cells(Row, 1).Value = Bug.Field("BG_BUG_ID")
        objSheet.Cells(Row, 2).Value = Bug.Summary
        objSheet.Cells(Row, 3).Value = Bug.DetectedBy
        objSheet.Cells(Row, 4).Value = Bug.Priority
        objSheet.Cells(Row, 5).Value = Bug.Status
        objSheet.Cells(Row, 6).Value = Bug.AssignedTo
        Row = Row + 1
    Next
    objExcel.ActiveWorkbook.Save()
    objExcel.ActiveWorkbook.Close()
    objExcel.Application.Quit()
    lr.end_transaction("ALM_ExportDefects_Export", lr.PASS)
    If td.Connected = True Then
        lr.start_transaction("ALM_ExportDefects_Logout")
        td.DisconnectProject()
        td.ReleaseConnection()
        lr.end_transaction("ALM_ExportDefects_Logout", lr.PASS)
    End If
    td = Nothing
    bugFactory = Nothing
    bugList = Nothing
    Action = lr.PASS
End Function

 

 VBA Setup of HP Load Runner -> Tools -> VBA Setup was installed on the Controller and LG.

 

 VB Vuser type scripts are running without any issue.

 

 In the above script I used excel object for exporting the captured data to a excel sheet.

 

On the Load Generator, In the MS Office 2008 was installed.

 

I have enabled the options but even then this error message is getting reproduced.

 

Please let me know on how to resolve this issue.

 

Regards,

Srihari

 

 

 

0 Likes
2 Replies
Highlighted
Knowledge Partner Knowledge Partner
Knowledge Partner

Re: VBA Error : Activex Component can't create object

Hi All,

 

I restarted the load generator machine to reflect the new Microsoft Excel Settings.

 

When I attempted to run the same script this time I am recieving the below error message.

 

Error: VBA Script Error: SaveAs method of Workbook class failed
          Source: Microsoft Office Excel
           wCode: 0 (0x00000000)
           sCode: -2146827284 (0x800a03ec)
    Help Context: C:\Program Files (x86)\Microsoft Office\Office12\1033\XLMAIN11.CHM (1001004)

 

Regards,

Srihari

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

Re: VBA Error : Activex Component can't create object

Hi, Please review the reply in LoadRunner Support Customer forum: http://h30499.www3.hp.com/t5/LoadRunner-Support-Customer/VBA-Error-Activex-Component-can-t-create-object/td-p/6276493

 

Kind regards,

HPE Support
If you haven’t tried it yet, come and join us in our entitled forums at Support Customer Forums

If you find that this or any post resolves your issue, please be sure to mark it as an accepted solution and give Kudos to the author for their assistance.
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.