Consulting

Results 1 to 5 of 5

Thread: Macro to enter filepath on click browse button

  1. #1

    Question Macro to enter filepath on click browse button

    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

  2. #2
    VBAX Guru Kenneth Hobs's Avatar
    Joined
    Nov 2005
    Location
    Tecumseh, OK
    Posts
    4,956
    Location
    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"

  3. #3

    Question

    Quote Originally Posted by Kenneth Hobs View Post
    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..

  4. #4
    VBAX Guru Kenneth Hobs's Avatar
    Joined
    Nov 2005
    Location
    Tecumseh, OK
    Posts
    4,956
    Location
    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.

  5. #5
    Quote Originally Posted by Kenneth Hobs View Post
    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"/>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •