简体   繁体   English

如何使用vbscript以读写模式打开qtp(.usr)文件

[英]how to open a qtp(.usr) file in read/write mode using vbscript

I am able to open QTP Application using vb script but when i try to open the file, it is opening in read only mode and when i run the script it don't read data from the excel sheet it should have been reading from. 我可以使用vb脚本打开QTP应用程序,但是当我尝试打开文件时,它正在以只读模式打开,而当我运行脚本时,它不会从应从其读取的excel工作表中读取数据。

Set oShell = CreateObject ("WScript.Shell")
Dim qtpAppObj,qtpTest

'Create the QTP Application object
Set qtpAppObj = CreateObject("QuickTest.Application") 

'Open the test in read-only mode
qtpAppObj.Open c:\test, True  

'set run settings for the test
Set qtpTest = qtpAppObj.Test

I am using the code above 我正在使用上面的代码

So i want to read an excel file and i think it can't be read because of the read-only mode. 所以我想读取一个Excel文件,由于只读模式,我认为它无法读取。

This True is for opening the test in read only mode. True为在只读模式下打开测试。

qtpAppObj.Open c:\test, True

Change it to false and run 将其更改为false并运行

qtpAppObj.Open c:\test, false

Can you Please show the code which is reading the excel file. 您能显示正在读取Excel文件的代码吗? I think you maybe reading data from Datatable. 我认为您也许正在从Datatable中读取数据。 So thats why it is reading from inside the test but not able to read with QTP AOM. 因此,这就是为什么它从测试内部读取但无法使用QTP AOM读取的原因。

Please show the excel reading code. 请显示excel阅读代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM