I need to download and save the file automatically from a URI. I think I can use the URLDownloadToFile from the urlmon library, but I wanted to use the WebClient.DownloadFile method.
I was hoping this would be cakewalk, but for reasons beyond my control, I cannot view or use members of the WebClient class in the VBA 7 IDE. I already referenced the .Net 2 framework of System.tlb and can see the classes in the System.Net namespace, but the members for many classes are not visible, and I cannot use them in my code.
I get a compilation error when trying to use this code:
Dim Downloader as New System.WebClient
Downloader.DownloadFile("uri","filename")
Perhaps I did not register the .Net classes that will be used in VBA and therefore the problem, but; System.dllmentioned in my project is inC:\Windows\Microsoft.NET\Framework\v2.0.50727\System.tlb
which bothers me even more. Also, it really helps if someone can describe the process of referencing the .Net Framework libraries in VBA 7.
Thanks in advance!
source
share