(Solved) – How do I select the “View in File Explorer” button on Sharepoint Online or at least run it’s action with VBA?

(solved)-–-how-do-i-select-the-“view-in-file-explorer”-button-on-sharepoint-online-or-at-least-run-it’s-action-with-vba?

I have a form that I convert to PDF and Dir() to a sharepoint online group. Periodically, my connection errors and I have to go into to sharepoint and click “View in File Explorer” under “all Documents” in my document library to reestablish the ability to upload files. I made a sub to open sharepoint in file explorer via Shell method, but it only functions if I, you guessed it, click on “View in File Explorer”. Can anybody either A, help with a work around other than opening the page and click “View…” or B how to actually click the button? I cycle through the elements, but the button I want doesn’t appear. I constantly get object required or object not set errors. Please let me know if you need more info.

[View of DropDown][1]

Here is the html for All Documents

Sub filexplorer2()

Dim IE As New SHDocVw.InternetExplorerMedium


Dim HTMLDoc As MSHTML.HTMLDocument


With IE
.Visible = True
.navigate "https://nov.sharepoint.com/teams/WBTuboscopeCoatingEngineering/POR Requests/Forms/AllItems.aspx"
Do Until .ReadyState = 4: DoEvents: Loop
End With

Set HTMLDoc = IE.Document

HTMLDoc.getElementsByClassName("ms-ContextualMenu-link root-453").Click


Set IE = Nothing
Set HTMLDoc = Nothing
End Sub

Leave a Reply

Your email address will not be published. Required fields are marked *