I am trying to download a Excel file from the attachment of a test case in QC. And import it to the Data Table of QTP local sheet. And when I set

SAPGuiSession("Session").SAPGuiWindow("Data Browser: Table /MSG/RVTGA").SAPGuiEdit("VTGNR"). Set DataTable("VTGNR", dtLocalsheet)

the VTGNR number is not getting updated. It's still the old value which I used to create the template.

Please help!!!!!!!Thanks!!!!!!

The script that I used to download the Excel from QC and import to local sheet is:

''Load the attachment

'testcase name, test script folder
Dim my_TestDir, my_FullTestDir

Dim i, j, cnt

'creating object
Dim objFSO, objTheFile

'current test, current attachment
Dim objTest, objAttf, objAttList, objAttLI

Dim blnFileExists

Dim qtApp

Const ForReading = 1

my_FullTestDir = Environment ("TestDir")
my_TestDir = Environment ("TestName")

Reporter.ReportEvent micDone, "Testcase Path: ", my_FullTestDir
Reporter.ReportEvent micDone, "Testcase Name: ", my_TestDir

' check if a connection to Quality Center is open
If Not QCUtil.IsConnected Then
Reporter.ReportEvent micFail, "No QC connection", "This test requires a connetion to QC in order to find attachments."
End If

Set objFSO = CreateObject("Scripting.FileSystemObject")

' retrieve the *.xls attachment from QC current test
Set objTest = QCUtil.CurrentTest

If objTest.HasAttachment Then
Set objAttf = objTest.Attachments

' newlist method for the access to the attachments
Set objAttList = objAttf.NewList("")

For j = 1 To objAttList.Count
Set objAttLI = objAttList.Item(j)

' save the .sql attachment to the local disk
If InStr(objAttLI.Name, ".xls") > 0 Then
strFilenameXLS = objAttLI.fileName
msgbox strFilenameXLS
' delete existing file
If objFSO.FileExists(strFilenameXLS) Then
objFSO.deleteFile strFilenameXLS
End If

' download .xls attachment to local disk
objAttLI.load true, "C:\"

Reporter.ReportEvent 2, "Download Test: ", strFilenameXLS
End If
End If

Set objAttLI = Nothing
Set objAttList = Nothing
Set objAttf = Nothing
Set objTest = Nothing

'************************************************* **********************************
Set objFSO = CreateObject("Scripting.FileSystemObject")

' check if .xls file is existing on the local disk
blnFileExists = objFSO.FileExists(strFilenameXLS)

If blnFileExists Then

Set qtApp = CreateObject("QuickTest.Application")
qtApp.Test.DataTable.ImportSheet strFilenameXLS,1,3

Reporter.ReportEvent micFail, "Download", "Attachment not downloaded"
End If

'************************************************* **********************************
Set objFSO = Nothing