0

I am trying to download an xlsx file from a webpage that requires a login. The name of the file also changes daily eg Mon04Apr_Download.xlsx

With my current code, I can login and caluculate what the name of the file will be, however then I am stuck.

Do I search the html (parse) for my known file name? If so, how do I click or download the file?

Or is there a way to always 'download' the top file on the list?

One last question, do I have top reset the code to recognise I am now on a different webpage after logging in? or will it recognise it automatically? (ie once the username & password form has been submitted)

I can put my code up here if it helps, however the actual webpage that I am trying to download from is behind the login screen so it might not be of any use.

Many thanks for any help you can give.

mpromonet
  • 11,326
  • 43
  • 62
  • 91
Stu
  • 115
  • 7
  • Based on this: http://stackoverflow.com/questions/17877389/how-do-i-download-a-file-using-vba-without-internet-explorer – Hugues Paquet Blanchette Apr 04 '16 at 19:49
  • I'm not sure if this is the same problem as mine? I have tried to use the code suggested but it doesn't appear to work for me. Thank you for the suggestion though – Stu Apr 04 '16 at 21:43

1 Answers1

1

If I understand the question correctly there would be one easy way to solve the problem with the changing name of the files. You said you were able to calcualte the name of the file.

'Define the different variables used in wanted file
PartOne = "Mon"
PartOTwo = "04"
PartThree = "April"

URL = "www.website.com/files/" & PartOne & PartOTwo & PartThree & "_Download.xlsx"

The url will then end up looking like this: www.website.com/files/Mon04Apr_Download.xlsx

The other questions I can't answer.