如何保存工作簿并处理TITUS(或任何其他文档分类加载项)弹出窗口? [英] How to save workbook and handle TITUS (or any other document classification add-in) popup?

查看:123
本文介绍了如何保存工作簿并处理TITUS(或任何其他文档分类加载项)弹出窗口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在HP UFT 12中创建一个脚本,该脚本针对CSV文件执行网格数据验证,并将结果保存在具有两个工作表的Excel文件中. 我之所以使用Excel,是因为它使用户更清晰,因为它允许单元格格式化,更容易比较数据等等.

I'm creating a script in HP UFT 12 which performs grid data validation against a CSV file and saves the results in a Excel file with two worksheets.
I'm using Excel for this because it is much more clear for the user, as it allows cell formatting, is easier to compare the data and so forth.

我的代码可以在我的机器上工作,但是我的客户端安装了TITUS文档分类加载项,因此,每当他们运行我的脚本时,它都会挂起,因为TITUS弹出消息要求用户在保存时对文档进行分类.该消息未显示给用户,可能是由于objExcel.DisplayAlerts = False引起的,但是脚本没有向前移动.

My code works in my machine, but my client has TITUS document classification add-in installed, so every time they run my script, it hangs because of the TITUS pop-up message that asks user to classify the document upon saving. The message is not displayed to the user, probably because of objExcel.DisplayAlerts = False, but the script does not move forward.

以下是我的代码中与该问题有关的部分(出于机密原因,我省略了大部分代码).

Following is the portion of my code which is related to the matter (I have omitted most of the code, for confidentiality reasons).

Dim objExcel : Set objExcel = CreateObject("Excel.Application")
Dim objWorkbook : Set objWorkbook = objExcel.Workbooks.Add
objExcel.Visible = False
Dim wsGrid : Set wsGrid = objWorkbook.Worksheets(1)
wsGrid.Name = "Grid Data"
Dim wsExported : Set wsExported = objWorkbook.Worksheets.Add
wsExported.Name = "Exported Data"

' Internal code to perform validation and fill worksheets ...

objExcel.DisplayAlerts = False
objWorkbook.SaveAs "C:\my_folder_path\my_file_name.xls"    ' This is where it hangs in machines where the add-in is installed
objWorkbook.Close
objWorkbook.Quit
Set objWorkbook = Nothing
Set objExcel = Nothing

我已经在网上搜索过,但到目前为止尚未找到任何与其相关的信息.我确实找到了

I have searched online but haven't find anything related to it so far. I did find this and this, but they are related to TITUS for Outlook and in neither one the issue is properly solved.
Does anyone know how to solve this, or can point me to a research material to help me solve this issue?

谢谢.

推荐答案

看起来很简单(我不知道我以前没有想到过),我设法通过添加objExcel.EnableEvents = False保存文件之前:

As ridiculously simple as it looks (I don't know how I haven't thought of this before), I manage to solve my issue by simply adding objExcel.EnableEvents = False before saving the file:

objExcel.DisplayAlerts = False
objExcel.EnableEvents = False   ' this is the problem solver for the matter!
objWorkbook.SaveAs "C:\my_folder_path\my_file_name.xls"
objExcel.EnableEvents = True    ' Not sure if this statement is necessary, though
objWorkbook.Close
objWorkbook.Quit
Set objWorkbook = Nothing
Set objExcel = Nothing

这篇关于如何保存工作簿并处理TITUS(或任何其他文档分类加载项)弹出窗口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆