Excel Macro to get by Security PopUp - vba

I am trying to write a macro to log into a website but I keep getting stopped by a security alert pop up that requires me to click OK to continue. Any idea what lines to put in to make it click on the OK button so I can proceed to the site?

If you want to stick with VBA, a few options come to mind. The quick and dirty approach would just be to use Sendkeys, and send Enter. It's super unreliable though, but may work in your specific case.
Another option is using windows APIs to send/post the relevant message to the window. See here
The final option I'll offer is considering Authotkey as a language stand-in. It makes this type of interaction really easy. It has COM support, so you can still use Excel, just like VBA.

http://www.contextures.com/excelvbasendkeys.html
SendKeys should be able to do this I think...
SendKeys "~"
O

Related

Using code to automatically click a mouse

I'm working with a Bloomberg data sheet and I need to export this sheet into Excel. The only way of doing so is through clicking the "export" button in the Bloomberg window. Is there any way to use code to accomplish this click. I would appreciate help with 1) indicating which coding language should be used 2) the physical code syntax that can accomplish my goal
I've tried using VBA, but there is no automatic control of the mouse.
There are two alternatives you may use to simulate mouse and keyboard automation on Windows platform.
AutoHotKey
AutoIT
I would personally recommend using AutoHotKey. It has a very extensive documentation and a fairly active community.
Additionally, please try to use keyboard shortcuts (E.g Alt+F) instead of mouse movements. If you're using keyboard shortcuts, you'll be less prone to unwanted behaviour.
Extra: If you have a web application, you may use Selenium. It works neatly with Java or Python.

AutoIt select item from menubar

i want to build some automation code that will select some item from a menubar of minimized (or non-active) window.
I have tried to do it with ControlSend function by sending some keys like alt and directions, but it's not working...
See my example:
I want to select the item "Select All", for this i wrote this code:
WinWaitActive("")
Send("{ALTDOWN}{ALTUP}{RIGHT}{ENTER}{DOWN}{DOWN}{ENTER}")
The code above works good, but i want that it will work when the window is not active, so i wrote this line:
ControlSend("", "", "Term Class1", "{ALTDOWN}{ALTUP}{RIGHT}{ENTER}{DOWN}{DOWN}{ENTER}")
This is not working for me, do you have some idea how can i implement it?
I too was trying to work with minimized windows but have since switched from windows so i wont be able to test things out for you. I have been told (and from experience) that you cant use control send (or the mouse click alternative which is called "control click") on applications that do not come stock with windows (applications that dont come with the computer, to put it simply).
However i came upon this (https://www.autoitscript.com/forum/topic/7112-minimized-clicking-great-for-game-bots/) which seems to be a 3rd party add in that lets you do just that, i tried using it but could not make it fit my needs. Perhaps you can, I would try to get it working for you but again, i dumped windows. The above link is the best candidate i have found, and by far the most promising after i searched and tested for about a month a while back, Good Luck.
EDIT: As always, i do not promise anything from the above link, you use it at your own risk.

Is there a list of Bloomberg DDE commands?

I'm trying to interface with Bloomberg Pro using DDEExecute but I'm having trouble finding a list of valid DDE commands.
In particular what I'm hoping to do right now is enter specific non-character keystrokes (e.g. "right arrow")
I agree with others that API is the way to go, but if for some reason you do not have the data, you can use a few different approaches including DDE or Sendkeys. I don't believe there is a list though, as bloomberg has said "Although the DDE and SendKeys functionality is documented here, we are unable to assist with specific uses of this functionality"
SendKeys method can be used in the following way:
' Activate a Bloomberg Professional Window (Window #1, in this case)
AppActivate "1-BLOOMBERG"
' Send commands to the Bloomberg Professional service Window
SendKeys "{ESC}" & "MSFT US {f8} DES~", True
Additional help on the "SendKeys" methods [Syntax of the keystrokes] can also be found in the MSDN Library - VBA Help Files, as well as in the Add-Ins Help file. This file can be opened from the Windows task bar by clicking the START menu and then Programs|Bloomberg.
The list including right arrow can be found here.

Cut and paste out of/ into text fields in a separate window doesn't work

I have a Macintosh Mozilla plugin which puts up a separate window for login information.
It seems to work fine, it gets keyboard events like typing and hitting
return to hit the default button. HOWEVER, it doesn't seem to get cut
and paste events. When I hit Cmd-v, the edit menu flashes, but nothing
happnes.
Is this a problem with my responder chain? Do I have to specially tell
Mozilla that I want these events? or am I likely to have some other
problem that I haven't even thought of?
It turns out the problem is that I'm using cocoa windows inside Mozilla, which isn't Cocoa... fail.

How can I send clicks or keys from a VB6 app to an Excel dialog box?

My employer has purchased a third-party tool, OfficeConverter from Conveter Technology that automates the conversion / repair of Office 2003-formatted files to Office 2007 format. This tool also highly automates the translation / change in macro / VBA code requirements between Office 2003 and 2007 formats.
My problem is that during this conversion the tool is opening the targeted Office product, say Excel and is then opening the target user file (ie. Report.xls) and is then examining any VBA / macro code for change requirements. The problem is that IF the Excel file code is dependent upon some external tool like an .OCX file and if that tool doesn't exist on the PC that I'm performing this action on, Excel will pop up a message that the Object has not been found, stopping the entire conversion process (thousands of files in a row) until someone comes along and MANUALLY clicks the appropriate button to close the dialogue box.
I figured that creating a small watching application in VB6 (hey, I'm old and my skills are too) could sit on the same PC and watch for these dialogue boxes and, depending on the specific message, click the appropriate button via the SendMessage API call.
The problem is that I haven't been able to get SendMessage to actually PUSH the button for me, I've tried sending it the Return key value (vbKeyReturn) or even the Space key (vbKeySpace) but the action never results in the dialogue box closing like it should. I can get the focus to tab between whichever buttons on the dialogue box are enabled, but that is about it.
I've attempted to use SendKeys, but that is far less reliable and strongly discouraged in the current documentation that I've come across.
Any suggestions? :)
If you have the hWnd for the button, and the machine is unattended, you can easily use MouseEvent to move the cursor over the button and click it. This sample includes a drop-in ready module that'll do the dirty work for you given just the window handle:
http://vb.mvps.org/samples/MouseEvent
Otherwise, the most straightforward way is probably to just send WM_LBUTTONDOWN and WM_LBUTTONUP sequentially.
EDIT: If you "just want to get it done" take Jim's advice and try Gary Chanson's Window Demon tool.
Take a look at this utility "Window Demon" by Gary Chanson
Karl: how quickly we forget our pals!
I would suggest taking a look at AutoIt.
It is perfect for this task, look for a window with a particular text on it and click a button.
Runs in the system tray as a standalone application.