PDA

View Full Version : Macro to enter filepath on click browse button



rahulm123
04-29-2016, 01:40 AM
Hi all,

I need to enter filepath from excel coloumn in dialog box , this dialog box is popup window on click of browse button in a webpage.
I am able to fetch filepath value from excel in VB and am able to click browse button but can't enter this filepath.
Cursor is blinking on FilePath in popup window but am not able to enter value in it.

May I know if you can help me.

Regards
Rahul

Kenneth Hobs
04-29-2016, 11:32 AM
Welcome to the forum!

Of course the easiest method is Application.SendKeys(). It should be avoided when at all possible though.

The better method is to use the MSIE object. For code examples, search for: "excel internet explorer object"

rahulm123
04-29-2016, 07:11 PM
Welcome to the forum!

Of course the easiest method is Application.SendKeys(). It should be avoided when at all possible though.

The better method is to use the MSIE object. For code examples, search for: "excel internet explorer object"

Hi Kenneth,

I tried
IEBrowser.getElementById("file").Value = "C://abc.txt"
IEBrowser.getElementById("file".Click

its clicking browse window , popup windows opens but no value in bar(C://abc.txt is missing)
i have tried Sendkeys(filepath) also but its not working.
any suggestions..

Kenneth Hobs
04-29-2016, 07:25 PM
SendKeys() solutions always depend on focus and timing. Look into Activate() to set the focus to your MSIE object.

Doing elements by ID is tricky. Look into the web site's source code to see if that will give a clue to the ID or Name.

rahulm123
04-29-2016, 07:50 PM
SendKeys() solutions always depend on focus and timing. Look into Activate() to set the focus to your MSIE object.

Doing elements by ID is tricky. Look into the web site's source code to see if that will give a clue to the ID or Name.

Source Code is :-

<input name = "file" id="file" type = "file onkeypress="return false" onchange="Jira.ui.attachment.uploadAttachment();" type="file" size="40"/>