+ Reply to Thread
Results 1 to 10 of 10

VBA code to 'click' Open in the Open or Save dialogue box on a webpage?

  1. #1
    Registered User
    Join Date
    08-29-2012
    Location
    South Yorks, England
    MS-Off Ver
    Excel 2010
    Posts
    32

    Question VBA code to 'click' Open in the Open or Save dialogue box on a webpage?

    Hi, new comer to VBA here - I have created a macro that navigates through a website but I can't get the macro to open or save the download (a csv file) when the 'Open or Save box' appears, please could anyone provide me with an example code/expression? Would the source code from the website in question be relevant to this?

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

    Re: VBA code to 'click' Open in the Open or Save dialogue box on a webpage?

    It would be helpful, certainly. Do you have to log into this website?

  3. #3
    Registered User
    Join Date
    08-29-2012
    Location
    South Yorks, England
    MS-Off Ver
    Excel 2010
    Posts
    32

    Re: VBA code to 'click' Open in the Open or Save dialogue box on a webpage?

    Kyle123, Yes the website does need a username and password. I have managed to add these into my code so that it logs in automatically (attached image shows a screen shot of where the macro gets to - its the Open that I want to 'click'). I have attached the source code to this reply - I'm not actually sure if the website manages the download or my internet browser (Naïve, I know)

    Screen shot where current macro gets me to.png
    Source code for website.txt

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

    Re: VBA code to 'click' Open in the Open or Save dialogue box on a webpage?

    Ok what's the link/button you press to initiate the download from the site - can you post the source here.

    It isn't in the text document you uploaded, the table is loaded separately from the source data

  5. #5
    Registered User
    Join Date
    08-29-2012
    Location
    South Yorks, England
    MS-Off Ver
    Excel 2010
    Posts
    32

    Re: VBA code to 'click' Open in the Open or Save dialogue box on a webpage?

    Kyle123, thanks when I hover over the download to csv button I see
    Please Login or Register  to view this content.
    - does this work for you?

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

    Re: VBA code to 'click' Open in the Open or Save dialogue box on a webpage?

    ok, just for sh*ts and giggles, try this, just a hunch. You'll need to fill in your username and password as well as set a location for where you want the csv saving
    Please Login or Register  to view this content.
    If this doesn't work we'll try and battle through ie
    Last edited by Kyle123; 08-31-2012 at 04:19 AM.

  7. #7
    Registered User
    Join Date
    08-29-2012
    Location
    South Yorks, England
    MS-Off Ver
    Excel 2010
    Posts
    32

    Re: VBA code to 'click' Open in the Open or Save dialogue box on a webpage?

    Morning Kyle, when I run the code you provided I get "Run-time error '3001' (Arguments are of the wrong type, are out of acceptable range, or are in conflict..) - this is at the
    HTML Code: 
    .
    Please could you check?

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

    Re: VBA code to 'click' Open in the Open or Save dialogue box on a webpage?

    It's difficult for me to check since I can't access the site

    Try this:
    Please Login or Register  to view this content.
    edit- Did you add in your username and password?

    EDIT - EDIT - actually scratch the above, just try changing:
    Dim resp As String to Dim resp() As byte
    Last edited by Kyle123; 08-31-2012 at 04:18 AM.

  9. #9
    Registered User
    Join Date
    08-29-2012
    Location
    South Yorks, England
    MS-Off Ver
    Excel 2010
    Posts
    32

    Re: VBA code to 'click' Open in the Open or Save dialogue box on a webpage?

    Brill, that works a treat! Thank you for your speedy and knowledgable help.

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

    Re: VBA code to 'click' Open in the Open or Save dialogue box on a webpage?

    Glad it's working

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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