Macro code to click on OK button in an Input Box that is launched through QTP - excel

I am executing few QTP scripts through excel macro. But sometimes QTP throws some pop up where we have to click on OK manually after entering some value. I want to simulate this action in my macro code.
Below is the screenshot of Input Box that I want to handle:
Problem is that this Input Box is launched through QTP Script But I want to click on OK button using excel macro code. So, How can I get this Input Box and perform desired action?

It looks like the QTP script is explicitly asking for user input during the test run. This means that you lose a lot of the advantages of automation by forcing a human being to sit next to the machine while the test is run.
I would suggest modifying the test so that it uses data automatically. In QTP this can be done via the data table or via test (or action) parameters.

Related

Allow "Mouse Click" event or "switch Excel tab" when a macro is running

I have a macro that extracts data from Microfocus RUMBA Mainframe Display and puts in Excel rows one after the other. I have created a Global Mainframe object and that is used for extraction to Excel. But when the process is running and if user decides to stop the processing he cannot click on Stop button on Excel or go to different tabs to see the data being pasted. He has to clicks like 6 times before tabs are switched or stopped.
I see that DoEvents allows mouse click events in the loop to do things but the code is written in a way that there is a lot of lines with in the loop and a function with no loop, and placing DoEvents after everyline seems irrational. I have a feeling there is a better to do that but not sure what that is. Can anyone please help?.
VBA is single threaded. So you can't have one VBA action interrupt another. If you had a cancel button, for example, and the user was allowed to click it via a DoEvents processing the cancel action would still run after the currently running procedure.
In Excel this single threaded nature ends up being a good thing because you generally don't want the user interacting with the workbook while you are making programmatic changes. If this was allowed you would get undefined behavior.
Your best course of action would be to make a .NET application that uses the Excel Interop extensions to move the data from the mainframe to Excel. If you use VB.NET then you will find the code is quite similar to VBA. In fact, the Excel.Application object model is identical so the macro code you already have ports cleanly over.
There is an add-in that will help RUMBA development here:
https://www.microfocus.com/documentation/rumba/desktop951/RumbaSystemAdminGuide/GUID-DDB7571D-6167-4F8B-876E-E7450F3030B2.html

What causes this popup in Excel VBA?

I am making a simple tool for my job. It involves opening a file dialog box, selecting a file, opening it, analyzing it for different items, then creating a new workbook with the results. This is all done with VBA macros, activated via a command button.
The code works fine, all does what it's supposed to. However, at the start when the file dialog box is first opened, sometimes this error message pops up:
It doesn't affect the code or how it runs whatsoever, but it is a bit of a nuisance. There is no further detail provided for this "error". Does anyone know what might cause this popup?

Excel Automation with IE

my original question posted
Simulate Double Click Event in IE EXCEL , VBA interaction
.
You said,
this is a deadlocks for me because 1) i trigger the prompt from excel
to retrieve data from server 2) the server is stop responding until
prompt is being dismissed 3) all codes coded to handle prompt not
being processed because excel still waiting for the #1 to complete
I made a tests with some suggestions in older threads, but nothing worked.
References of those older threads.
(1) Disable Alert message of a webpage using VBA code (Refer the second answer)
(2) vba to dismiss an IE8 or IE9 "message from webpage" popup window
The thing is that, VBA code execution get stops when IE display the Alert() message. As code execution is already stopped we are not able to handle the Alert() prompt using code. So user need to close the Alert() prompt manually which resumes the code execution.
For simplicity in testing, if you just try to create an IE object and display the prompt and put some other lines of code after the prompt than you will notice that execution of code get stopped when prompt get displayed and until you close the prompt manually further lines of code will not get execute.
I agree with the suggestion given by the Zhi Lv - MSFT in your referenced thread for using the Selenium Web driver.
It can be the easiest solution for this issue.
References:
(1) Selenium Web Driver
(2) Selenium handle alerts prompts confirmation popups

How to supply user arguments for a script invoked via Custom Ribbon from within Excel?

I have a python script that needs to run on my linux server with some arguments:
e.g.
python testprogram.py --arg1=abc --arg2==xyz
I have a custom Ribbon implemented in my Excel file (on windows desktop client). How can I implement some kind of pop-up so that when I click on the ribbon, it launches the pop-up to allow the user to specify input arguments arg 1 & arg2 and then invoke the python script that can run remotely on the linux server? I need to accomplish this while leaving the excel workbook open, hence I am using the custom ribbon. Not sure if there is a better way to do this.
Any suggestions?
Thanks.
Set it up such that when you click on a button in the ribbon, a userform appears (google how to trigger a userform)(will need to trigger this userform with an event...like a button click). Then, on the userform, put a couple input boxes and a button. Add code for the userform such that on the button_click(), the program will collect the user input and call the python program w those arguments (google how to call python program from excel VBA)

Excel - Countdown Message box until Macro is Complete

I have a Macro which takes 45 seconds to complete. When the macro starts I want a Countdown timer to pop up like a message box which will countdown until Macro completion. I have searched but so far cant find any answers to this. Is this possible?
As #Thrum correctly mentioned in his comment this is not possible with a message box.
A MsgBox is modal and therefore blocks the entire Excel application. Nothing else can happen / be done while that message box window is open and waits for you to close it. Actually, you can even make message boxes system-wide modal. In that case no other Windows application will respond unless you close that little message box in Excel (check the option vbSystemModal within the VBA help regarding MsgBox).
However, with forms on the other hand you have a choice. You can make the form not modal.
UserForm1.Show (False)
In that case the code continues to run in the background while the form is shown to the user and permits the running VBA code to make changes to the form while it is shown to the user.

Resources