+ Reply to Thread
Results 1 to 5 of 5

How to call onClick Javascript function in VBA

  1. #1
    Registered User
    Join Date
    07-21-2013
    Location
    Philippines
    MS-Off Ver
    Excel 2010
    Posts
    46

    Post How to call onClick Javascript function in VBA

    Hi Experts!

    In a manual process, when I click the save button, it will pop-up a confirm() javascript function, so I need to click the "OK" to proceed. I am automating an upload function in a web page.
    I have a problem executing an onclick function in a web page using VBA.
    see below the javascript code of the "save" button.
    HTML Code: 
    I have no problem in clicking the "save" button, I can do that using code below
    Please Login or Register  to view this content.
    The problem is when I click the "save" button, the confirm pop-up will appear and the macro will stop running from there unless the pop-up had been pressed.
    and so I came up in another solution removing the pop-up message using the code below.
    HTML Code: 
    Using that code, I am able to attach the attachment without any problem, the pop-up is gone and I am able to click save.
    But the problem is, I am able to attach the file but it is not uploading in the site. Then when I review the HTML code of the web page.
    using the onClick function it calls the submitbutton_click(); Javascript function, and the code for that is below
    HTML Code: 
    HTML Code: 
    Reviewing the javascript codes, I think the upload will only run when I execute the javascript function "uploadobj.startupload();" but then I had no success in running the javascript function.

    here are the codes I have tried so far:
    HTML Code: 
    Re Post in : http://www.mrexcel.com/forum/newthre...newthread&f=10

    http://www.vbaexpress.com/forum/show...274#post324274
    Last edited by mackypogi; 05-13-2015 at 01:40 AM.

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: How to call onClick Javascript function in VBA

    I have not read then entire post, but I had experienced the same issue with Java script and HTML.
    It seems to work with Internet Explorer, but not with CreateObject("MSXML2.XMLHTTP"). I do not know if the syntax is different with MSXML2.XMLHTTP or it does not work with Java script.

  3. #3
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: How to call onClick Javascript function in VBA

    I have not read then entire post, but I had experienced the same issue with Java script and HTML.
    It seems to work with Internet Explorer, but not with CreateObject("MSXML2.XMLHTTP"). I do not know if the call syntax is different with MSXML2.XMLHTTP or it does not work with Java script.

  4. #4
    Registered User
    Join Date
    07-21-2013
    Location
    Philippines
    MS-Off Ver
    Excel 2010
    Posts
    46

    Re: How to call onClick Javascript function in VBA

    @AB33 - What does that mean?

  5. #5
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: How to call onClick Javascript function in VBA

    I *think* he's asking how you are getting the source of the webpage, whether you are doing it with the quick msxml/winhttp method or the slower automation of internet explorer

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Using VBA To Execute Javascript Function
    By ypatel1990 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-13-2014, 11:17 AM
  2. Call Javascript in VBA using IE object / update DateDropBox
    By shahzeb in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-07-2014, 02:36 PM
  3. Replies: 4
    Last Post: 08-18-2012, 01:34 PM
  4. Javascript function converting to Excel function
    By kamila in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 01-31-2007, 07:06 AM
  5. [SOLVED] How can I call a JavaScript Function from Excel VBA
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-17-2006, 10:40 AM

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1