I'm trying to use VBA code to invoke a protected API which need authentication with OAuth2. Once I try to open a URL, I'm redirected to the ADFS page for authentication and than I come back.
Now for some applications using CreateObject("InternetExplorer.Application")
and the .Navigate URL
works fine, for other web app I need to use New InternetExplorerMedium
in order to have the code working.
Can you tell me the differences between these objects and why some websites work with one and some work with the other?
Thank you
This way of referring to objects is called "Early" and "Late Binding". From MSDN:
TL DR:
The difference is that in early binding you get intellisense and compiling time bonus, but you should make sure that you have added the corresponding library.
First make sure that you add the MS Excel 16.0 Object Library from VBE>Extras>Libraries:
Related articles: