Link to home
Start Free TrialLog in
Avatar of vijay vj
vijay vjFlag for India

asked on

Need vba as unzip function is not executing .

Dear sir , i have vba where its download the zip file from web to destination folder and its have to unzip and delete the zip file, i have vba code where its download the zip file but its not executing the unzip vba , kindly i need help to correct it..

thanks , i have attached my excel file.
NSE-OI-REPORT.xlsm
Avatar of Robberbaron (robr)
Robberbaron (robr)
Flag of Australia image

1/ in my testing, you need to ensure that gstDestinationFolder has a trailing \  for the Unzip routine to find the zip files

Private Sub CommandButton1_Click()
  bTrace = CheckBox1.Value
  bDelete = CheckBox1.Value
  dStartDate = Range("E6")
  dEndDate = Range("F6")
  sHTTP = Sheets("Sheet1").Range("B10")
  gstDestinationFolder = Range("C10")
  If bTesting Then gstDestinationFolder = ActiveWorkbook.Path & "\Temp\"
   If Right(gstDestinationFolder, 1) <> "\" Then gstDestinationFolder = gstDestinationFolder & "\"  '<<added

Open in new window


the target folder then ends up with the csv files.

another issue may be that the destination folder you have set is with the User area.  This may not have sufficent access rights.  I used C:\Temp\OI in my testing and csv files are there ok
Avatar of vijay vj

ASKER

But i have similar file which works perfectly as unzipped and formatting the csv file to txt file.
2.jpg
1.jpg
Open the VBE and make sure the URL is valid.
Whether it is or not will be printed to the immediate window.
The problem is zip files are directly downloading to the destination folder but , its not unzipping the files,i have vba code for unzip but its not working.. sir....
ASKER CERTIFIED SOLUTION
Avatar of vijay vj
vijay vj
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
i have found solution , admin kindly close the question as no error in vba, i think