Forum Discussion

kheldar's avatar
kheldar
Iron Contributor
May 27, 2022
Solved

VBA and SharePoint URL Longer Than 255 Characters

Hello,   Is there a workaround to bypass this error?     Sub CallFile(ByVal File As String) Workbooks("Master Workbook.xlsm").Activate Debug.Print File Workbooks.Open File End Sub   ...
  • kheldar's avatar
    kheldar
    Jun 01, 2022

    kheldar 

    I managed to do it with network drive mapping

     

    my code:

    Public Function SPDrive(Drive As String, Url As String)
    On Error Resume Next
    Dim objNet As Object
    Dim FS As Object
    Dim objFolder As Object
    Set objNet = Nothing
    Set FS = Nothing
    Set objFolder = Nothing
    Set objNet = CreateObject("WScript.Network")
    Set FS = CreateObject("Scripting.FileSystemObject")
    Set objFolder = FS.getfolder(Drive)
    objNet.RemoveNetworkDrive Drive
    objNet.MapNetworkDrive Drive, Url
    
    Debug.Print Url
    End Function

Resources