3
I’m trying to develop a script with vba, no excel, to facilitate a routine we have at work, which inserts about 9,000 data into the internal system. Currently we manually enter this data. This data will never be the same, as it is obtained after several document checks.
As this system is a page, which we access by browser, I’m using the Application.SendKeys
so I can manipulate him.
He owns two logins. The first is quiet to do and after doing it, it shows us a selection of systems (as per the image below)
To access the second login, we have to select "PERSONAL". But it is only possible to select it using two mouse clicks. Press TAB and use arrows until you reach the option you need and then press ENTER does not resolve.
Would it be possible to make this click with VBA? I’ve seen that has something like .click
, but I have no idea how I would do that.
The code to generate the picture frame, is below:
<!-- QUADRO DE SELECIONAR O SISTEMA-->
<span id="pnlUsuarioSistema_span" style = "position:absolute;top:210px;left:258px;height:197px;width:321px;background-color:F2F4F2;border-color:004080;border-style:Solid;border-width:1px;font-family:Verdana;font-size:11;font-style:normal;font-weight:normal;-moz-box-sizing:border-box;">
<label name="lblTexto" id="lblTexto" style = "background-color:F2F4F2;color:004080;font-family:Verdana;font-size:12;font-style:normal;font-weight:bold;height:21px;left:15px;position:absolute;top:15px;width:303px;">Selecione o sistema que deseja ingressar:</label>
<select name="usrSysList" id="usrSysList" size="2" originalClass="DBList" style = "font-family:Verdana;font-size:12;font-style:normal;font-weight:normal;height:141px;left:17px;position:absolute;top:36px;width:285px;" ondblclick="openNewSession()">
<option value="http://(...)MAV">MAV</option>
<option value="http://(...)ORCOM">ORCOM</option>
<option value="http://(...)PESSOAL">PESSOAL</option>
</select>
</span>
<!-- FIM QUADRO -->
I didn’t understand the details of the problem. The system in the nevagador is developed by yourselves? This VBA is running in which tool? Would it be in Excel, for example? Something else (plus a hint): you have considered using the Autohotkey? Maybe it’s much simpler than trying to build something in VBA.
– Luiz Vieira
@Luizvieira I am writing the script in Excel. This system is very old, but it wasn’t developed by us. I didn’t know Autohotkey. It would be possible to use data from other software, such as an Excel spreadsheet?
– Ricardo Alves
I don’t think so. It essentially serves to automate manual tasks (like what I understood you wanted to do). You have data that accurate use/manipulate in Excel? This is not in the question. Anyway, I don’t know if the VBA can do what you want natively, but I don’t think so. However, it may be possible to play what Autohotkey does by importing native Apis from Windows. Take a look at the function
SendInput
.– Luiz Vieira
Some examples that use this function to simulate keystrokes: http://www.mrexcel.com/forum/excel-questions/411552-sendinput-visual-basic-applications.html and http://stackoverflow.com/questions/13896658/sendinput-vb-basic-example; An example of Click (but it’s in VB, not in VBA): http://www.vbforums.com/showthread.php?734167-Mouse-Move-and-Click-with-Windows-API-Function-SendInput
– Luiz Vieira
Thanks, @Luizvieira. With these addresses you’ve passed, I think I’ll be able to write a routine, for what I need.
– Ricardo Alves
If you can, post yourself an answer here. Who knows helps someone else in the future. :)
– Luiz Vieira