Up / Download do VBA do Excel de várias pastas do SharePoint

Encontrei um exemplo de código na Internet para baixar arquivos de uma pasta do SharePoint usando o VBA (aberto no Explorer, mapear para letra da unidade etc.)

Portanto, eu escrevi o seguinte código:

Dim sharepointFolder As String
Dim colDisks As Variant
Dim objWMIService As Object
Dim objDisk As Variant
Dim driveLetter As String

'Create FSO and network object
Set objNet = CreateObject("WScript.Network")
Set fs = CreateObject("Scripting.FileSystemObject")

'Get all used Drive-Letters
Set objWMIService = GetObject("winmgmts:\\" & "." & "\root\cimv2")
Set colDisks = objWMIService.ExecQuery("Select * from Win32_LogicalDisk")

'Loop through used Drive-Letters
For Each objDisk In colDisks
    For i = 65 To 90
        'If letter is in use exit loop and remember letter.
        If i = Asc(objDisk.DeviceID) Then
            j = i
            Exit For
        'letters which are not checked yet are possible only
        ElseIf i > j Then
            driveLetter = Chr(i) & ":"
            Exit For
        End If
    Next i
    'If a Drive-Letter is found exit the loop
    If driveLetter <> "" Then
        Exit For
    End If
Next

'define path to SharePoint
sharepointFolder = "https://spFolder/Sector Reports/"
'Map the sharePoint folder to the free Drive-Letter
objNet.MapNetworkDrive driveLetter, sharepointFolder
'set the folder to the mapped SharePoint-Path
Set folder = fs.GetFolder(driveLetter)

Nesta fase, eu posso fazer upload de arquivos para a pasta:

https://spFolder/Sector Reports/

No entanto, também quero fazer upload de arquivos para a pasta, por exemplo:

https://spFolder/Documents/

e também removi a letra da unidade anterior usando a função:

removeDriveLetter "Letter" 

Agora eu tenho o problema, que se eu mapear uma nova pasta para uma carta:

mapDriveLetter "A:\", sharepointFolder

e deseja salvar algo nesta carta, ela sempre será salva no caminho anterior. Por exemplo:

mapDriveLetter "A:\", sharePointFolder1
removeDriveLetter "A:\"
mapDriveLetter "A:\", sharePointFolder2
workbook.saveas "A:\" & workbookName

Nesse caso, a pasta de trabalho é sempre salva no caminho fornecido em "sharePointFolder1" e não em "sharePointFolder2".

questionAnswers(1)

yourAnswerToTheQuestion