May 26 2022 05:57 PM
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
This is my macro. The argument that's passed to the macro through a command button is longer than 255 characters and I'm getting an error. URLs that are shorter than 255 characters work without a problem.
I'd really appreciate your assistance.
May 27 2022 03:46 AM
Maybe you could put in a memo field and call the hyperlink using the "FollowHyperlink Method".
You start this either by clicking in the text field or by using the command button.
Everything only theoretically, I do not know such a long link to try :).
or
Split hyperlink into two cells. write a part in A1 and a part in A2, then you could put the hyperlink together and call it.
=HYPERLINK(A1&A2,"ClickMe")
or
look at this link there is a VBA code that promises to work around it (untested).
Everything only theoretically, have not tried such a long link:).
Add. Info. :
Microsoft has increased the maximum length for path names in OneDrive for Business and SharePoint Online from 256 Unicode characters to 400.
Hope I was able to help you with this information / links.
I know I don't know anything (Socrates)
May 27 2022 07:25 AM
May 27 2022 08:44 AM
Jun 01 2022 03:59 AM
Solution@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
Jun 01 2022 03:59 AM
Solution@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