Need vba to download and copy the data from zip file

Or just use this:
DestWorkbook = "Autobuy.xlsm"
Its folder does not matter for the code as it is already open
 
Upvote 0

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Hi Sir,

Thanks for this awesome code !!!!

I have an issue that name of csv file from where I am extracting data includes date and changes everyday as below

https://www.nseindia.com/content/historical/EQUITIES/2019/JUN/cm06JUN2019bhav.csv.zip

as on today,
tomorrow it will be

https://www.nseindia.com/content/historical/EQUITIES/2019/JUN/cm07JUN2019bhav.csv.zip


kindly suggest a change in code.

Thanks...


Or just use this:
DestWorkbook = "Autobuy.xlsm"
Its folder does not matter for the code as it is already open
 
Upvote 0
Hi & welcome to MrExcel Board!
Use this line in the code to get a date dependent url:
Code:
  UrlFile = "https://www.nseindia.com/content/EQUITIES/" & [TEXT(NOW(),"YYYY/MMM/c\mDDMMMYYYY")] & "bhav.csv.zip"
Regards
 
Upvote 0
Hi ZVI,

Thanks a lot for such prompt answer !!!

This has resulted same as I was expecting. But there is a minor thing left which I could not mention at the time of sending my querry.

This code is resulting as below

https://www.nseindia.com/content/historical/EQUITIES/2019/Jun/cm08JUN2019bhav.csv.zip

But there is a minor change in Format of Month Name as below (REQUIRED IN CAPS)

https://www.nseindia.com/content/historical/EQUITIES/2019/JUN/cm08JUN2019bhav.csv.zip

Kindly help me for this change too.

Regards.
 
Upvote 0
Hi, try this then:
Rich (BB code):
  Dim MonthName As String
  MonthName = [TEXT(NOW(),"MMM")]
  UrlFile = "https://www.nseindia.com/content/EQUITIES/" & [TEXT(NOW(),"YYYY/MMM/c\mDDMMMYYYY")] & "bhav.csv.zip"
  UrlFile = Replace(UrlFile, MonthName, UCase(MonthName))
 
Upvote 0
Working 100% accurate.

Big THANKS !!!



Hi, try this then:
Rich (BB code):
  Dim MonthName As String
  MonthName = [TEXT(NOW(),"MMM")]
  UrlFile = "https://www.nseindia.com/content/EQUITIES/" & [TEXT(NOW(),"YYYY/MMM/c\mDDMMMYYYY")] & "bhav.csv.zip"
  UrlFile = Replace(UrlFile, MonthName, UCase(MonthName))
 
Upvote 0
You are welcome, thanks for the feedback! :)
 
Upvote 0
Hi ZVI,

Thanks a lot for such prompt answer !!!

This has resulted same as I was expecting. But there is a minor thing left which I could not mention at the time of sending my querry.

This code is resulting as below

https://www.nseindia.com/content/historical/EQUITIES/2019/Jun/cm08JUN2019bhav.csv.zip

But there is a minor change in Format of Month Name as below (REQUIRED IN CAPS)

https://www.nseindia.com/content/historical/EQUITIES/2019/JUN/cm08JUN2019bhav.csv.zip

Kindly help me for this change too.

Regards.
 
Upvote 0

Forum statistics

Threads
1,216,350
Messages
6,130,139
Members
449,560
Latest member
mattstan2012

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top