I already described 2 methods how to download file from URL in one of my old articles. They are really good, but not the only methods. In this article I’m going to present the way to download file using WinHttp & ADODB method.
Some components of Microsoft Exchange Server rely on Microsoft Windows HTTP Services. WinHTTP provides a server-supported, high-level interface to the HTTP/1.1 Internet Protocol. WinHTTP enables Exchange to retrieve enabled encryption levels, specify the security protocol, and interact with server and client certificates when establishing an.
- Can someone help me with this. It all works but i'd like to be able to read file line by line and put into my workbook. This returns everything headers and data all in one string.
- Download Valuatum Excel model (usually by selecting Analyst from the top menu – Excel Files) Open Valuatum Excel model. If you use DB2Excel for the first time, make sure that Microsoft WinHTTP services are available. Go to the I-main sheet. Click the button Download data. Write your login information and click Continue.
- Support for server and proxy authentication, including integrated support for Microsoft Passport 1.4 and the Negotiate / Kerberos package Automatic handling of redirects unless suppressed As with WinINet, WinHTTP leverages the underlying Sockets Interface and Emulator to access the network, as shown below.
How to understand mix of those methods?
In simple words – send request to the server of specified URL, put the request response body into created data flow (stream) and save to the specified location.
Having this little imagination, we can start coding.
So, to be able to use ADODB, we need to send the request using WinHTTP object.
WinHttp method
First of all, let’s set the reference to have the possibility to use early binding. In my case it is Microsoft WinHTTP Services, version 5.1 in Options/References.
Having that done we can declare and set the WinHTTP object.
Now it’s time for the URL of the file to download. For the URL example we will use the meme from the How to download file from URL article.
Then we can open and send the request to the server to get the file.
There is one last thing before we can go to the second part of our approach. We need to pass the path for the new file. Not to complicate the things we will just take the path of ThisWorkbook and type picture1.jpg for the name of the file.
OK, there is everything what we will require to pass to the ADODB method to download the file.
ADODB method
To be able to use early binding of ADODB we have to set the Microsoft ActiveX Data Objects reference.
To be able to save the file using SaveToFile function we have to set the Microsoft Scripting Runtime reference.
So firstly we need to declare and create new ADODB Stream.
Secondly we should create-open the Stream and set its type as binary.
And there goes the most important part – we will write to the stream the responseBody property of the WinHTTP object and setting the stream position to the start.
To use the SaveToFile function we will declare and set the FileSystemObject of the Scripting library.
And finally we can save and close the downloaded file.
WinHTTP & ADODB full code
Gathering all together, there are 2 subroutines to have everything nice and clear.
In this article You could learn how to download file using WinHTTP and ADODB. I hope it will be another useful alternative to download from URL.
Here’s a shortlist of some useful troubleshooting techniques, divided into two sections according to the two main types of MS Office Installations:
MSI: “Traditional” Windows installer
Click-to-Run: Office 365 installed MS Office
MS Office MSI Install Troubleshooting
“Verbose logging” is a setting that exposes more information during the installation process. It will capture “warning” as well as “error” messages that provide us with clues to your problem. To do onetime verbose logging:
Diagnosing When Setup Stops Responding At times, Office Setup stops responding (hangs), and you do not receive any error message. The best thing to do in this situation is to restart your computer, and run Office Setup again with complete verbose logging turned on (with one additional option). To do this, start Office Setup. To do so, follow these steps:
- Click Start, and then click Run.
- In the Open box, type the following command line, and then click OK:
pathSetup.exe /L*v! C:Verboselog.txt
Note that Path is the full path of your Office source location.
To enable Windows Installer logging yourself, open the registry with Regedit.exe and create the following path and keys:
HKEY_LOCAL_MACHINESoftwarePoliciesMicrosoftWindowsInstaller
Reg_SZ: Logging Value: voicewarmupx
The letters in the value field can be in any order. Each letter turns on a different logging mode. Each letter’s actual function is as follows for MSI version 1.1:
v – Verbose output
o – Out-of-disk-space messages
i – Status messages
c – Initial UI parameters
e – All error messages
w – Non-fatal warnings
a – Start up of actions
r – Action-specific records
m – Out-of-memory or fatal exit information
u – User requests
p – Terminal properties
+ – Append to existing file
! – Flush each line to the log
x – Extra debugging information. The “x” flag is available only on Windows Server 2003 and later operating systems, and on the MSI redistributable version 3.0, and on later versions of the MSI redistributable.
“*” – Wildcard, log all information except for the v and the x option. To include the v and the x option, specify “/l*vx”.
Note This should be used only for troubleshooting purposes and should not be left on because it will have adverse effects on system performance and disk space. Each time you use the Add/Remove Programs tool in Control Panel, a new Msi*.log file is created.
When looking through the MSI logs we will typically want to look for a value 3 entry in the logs. Windows installer returns codes during the install which will indicate if a particular function was successful or not.
Value 1 = Success
Value 2 = Cancel
Value 3 = Error
Excel Install Microsoft Winhttp Services Version
Note: make sure to turn off verbose logging after you are done.
Enable verbose logging before collecting the log files.
- Click on Start -> All Programs
- Accessories -> RUN
- Type reg add HKLMSOFTWAREMicrosoftClickToRunOverRide /v LogLevel /t REG_DWORD /d 3
- Click on OK.
Now try to install Microsoft Office 2016 to get the error message so that the log files get created.
Follow the steps below to access the ‘Temp’ folder.
- Click on Start -> All Programs
- Accessories -> RUN
- Type %temp% -> Click on OK
The following are the log files that may be present in the %windir%temp folder (c2r is for Click to Run):
Bootstrapper*.log
c2r_*.log
C2RIntegrator*.log
Firefly*.log
Integratedoffice.exe_c2r*.log
Interceptor*.log
*.exe.log
*_c2rdll*
For MSI, “Normal”, installations the log files will look like MSI****.LOG
Further References:
http://support.microsoft.com/kb/2545723 – “Fix Its” to turn logging on and off
http://blogs.technet.com/b/odsupport/archive/2010/12/30/trouble shooting-office-installation-failures.aspx Office 2003-2010, analyse log
http://support.microsoft.com/kb/223300 – “Fix It” enable XP, Server 2003-8
http://support.microsoft.com/kb/826511 – help interpretting logs
http://technet.microsoft.com/en-us/library/cc978342.aspx
MS Office Click-To-Run Install Troubleshooting
The following steps show you how to enable verbose logging to help you troubleshooting Office 365 install/update failures.
To enable verbose logging, launch cmd as administrator and run the following command:
ULS log file is created both in the %temp% folder and the %windir%temp folder. The file name is of the following format:
For example Keith-201420141610-1434.log. Once these logs have been retrieved and analyzed, verbose logging should be disabled by running the following command from an administrative command-prompt:
reg delete HKLMSOFTWAREMicrosoftClickToRunOverRide /v LogLevel /f
Excel Install Microsoft Winhttp Services
The log output is in ULS format. Opening the log file in Excel will help you with filtering the data. First, you want to look for is the term “unexpected”. You can look for “Fail” and /or “Error”
When Attempting to Install Office 365 Directly from the Office Portal
Most end user issues with installing/activating Microsoft Office 365 from the Office Portal are proxy/firewall related. Follow the steps above to review log files.
Process Monitor and Fiddler are also great tools to use for troubleshooting Office 365 ProPlus installation and activation errors. If possible, try to test using a less restricted proxy/firewall. If the activation is successful on another network, you may need make adjustments to your proxy/firewall settings.
The following article can help you with determining the IP address and URL exceptions you might need to add:
- Office 365 URLs and IP address ranges http://technet.microsoft.com/library/hh373144.aspx
Start by white listing or adding exceptions for the IP addresses and URLs under “Office 365 ProPlus”. If you continue to have problems, add the URLs under the “Office 365 portal and identity” section.
If still have problems, try the following:
MS Office MSI Install Troubleshooting
“Verbose logging” is a setting that exposes more information during the installation process. It will capture “warning” as well as “error” messages that provide us with clues to your problem.
To do onetime verbose logging:
Diagnosing When Setup Stops Responding At times, Office Setup stops responding (hangs), and you do not receive any error message. The best thing to do in this situation is to restart your computer, and run Office Setup again with complete verbose logging turned on (with one additional option). To do this, start Office Setup. To do so, follow these steps:
- Click Start, and then click Run.
- In the Open box, type the following command line, and then click OK:
pathSetup.exe /L*v! C:Verboselog.txt
Note that Path is the full path of your Office source location.
To enable Windows Installer logging yourself, open the registry with Regedit.exe and create the following path and keys:
HKEY_LOCAL_MACHINESoftwarePoliciesMicrosoftWindowsInstaller
Reg_SZ: Logging Value: voicewarmupx
The letters in the value field can be in any order. Each letter turns on a different logging mode. Each letter’s actual function is as follows for MSI version 1.1:
v – Verbose output
o – Out-of-disk-space messages
i – Status messages
c – Initial UI parameters
e – All error messages
w – Non-fatal warnings
a – Start up of actions
r – Action-specific records
m – Out-of-memory or fatal exit information
u – User requests
p – Terminal properties
+ – Append to existing file
! – Flush each line to the log
x – Extra debugging information. The “x” flag is available only on Windows Server 2003 and later operating systems, and on the MSI redistributable version 3.0, and on later versions of the MSI redistributable.
“*” – Wildcard, log all information except for the v and the x option. To include the v and the x option, specify “/l*vx”.
Note This should be used only for troubleshooting purposes and should not be left on because it will have adverse effects on system performance and disk space. Each time you use the Add/Remove Programs tool in Control Panel, a new Msi*.log file is created.
When looking through the MSI logs we will typically want to look for a value 3 entry in the logs. Windows installer returns codes during the install which will indicate if a particular function was successful or not. Value 1 = Success Value 2 = Cancel Value 3 = Error
Note: make sure to turn off verbose logging after you are done.
Enable verbose logging before collecting the log files.
- Click on Start -> All Programs
- Accessories -> RUN
- Type reg add HKLMSOFTWAREMicrosoftClickToRunOverRide /v LogLevel /t REG_DWORD /d 3
- Click on OK.
Now try to install Microsoft Office 2016 to get the error message so that the log files get created.
Follow the steps below to access the ‘Temp’ folder.
- Click on Start -> All Programs
- Accessories -> RUN
- Type %temp% -> Click on OK
The following are the log files that may be present in the %windir%temp folder (c2r is for Click to Run):
Bootstrapper*.log
c2r_*.log
C2RIntegrator*.log
Firefly*.log
Integratedoffice.exe_c2r*.log
Interceptor*.log
*.exe.log
*_c2rdll*
For MSI, “Normal”, installations the log files will look like MSI****.LOG
Open the command prompt (run as administrator), and use the following command to import the manual proxy settings from IE:
Now rerun the install/update
To reset winhttp back, run the following command:
Most failed installs directly from the Office portal that are proxy related, usually fail pretty quick and usually with an error like this:
“Sorry, we ran into a problem Go online for additional help. Error Code: 30174-4.”
Or When attempting to update a client that is looking to the Office portal for updates will get something like this:
“Something went Wrong: We’re sorry, we ran into a problem while downloading updates for Office. Please check your network connection and try again later. Error Code: 30088-28 or 30088-27”