I need to download and save a file automatically from a URI. I think I can use URLDownloadToFile from "urlmon" library but I wanted to use the WebClient.DownloadFile method.
I hoped it would be a cakewalk but for reasons beyond me, I am not able to view or use the members of the WebClient class in the VBA 7 IDE. I have already referenced the .Net 2 framework's System.tlb and am able to see the classes in the System.Net namespace but members for many of the classes are not visible and I cannot use them in my code.
I get a compilation error on trying to use a code like:
Dim Downloader as New System.WebClient
Downloader.DownloadFile("uri","filename")
Maybe I have not registered the .Net classes to be used in VBA and hence the problem but; the System.dll
being referred to in my project is located at C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.tlb
which confuses me even more. Also, it will really help if someone can detail out the process to reference .Net Framework libraries in VBA 7.
Thanks in advance!