AppleGaming
New Member
- Joined
- Jul 1, 2019
- Messages
- 3
I'm getting run-time error '1004': The file path you entere is too long. Enter a shorter file name or select a shorter file path, and then try saving the file again.
When I debug I get taken to "ThisWorkbook.SaveAs StandardFile"
However, I'm only getting this error when a particular user on his computer runs the code. There are two other users that run the code and have no issues. The file length never changes in size just the date. Additionally, this doesnt make sense because I've gone to the trouble to map the sharepoint paths to drives on the local computer. So the path that gets saved is
A:\qwer asdfghjk zxcvbnm 07_02_2019 Mobile and Excel 2007.xlsm
and that is well under the max length. Finally, even if the path was not mapped and I wanted to save directly to the sharepoint, the path is only 233 at it's longest.
Anyone have thoughts? googleing this is near impossible because I dont think the path error is accurate even though that's whats getting reported.
When I debug I get taken to "ThisWorkbook.SaveAs StandardFile"
However, I'm only getting this error when a particular user on his computer runs the code. There are two other users that run the code and have no issues. The file length never changes in size just the date. Additionally, this doesnt make sense because I've gone to the trouble to map the sharepoint paths to drives on the local computer. So the path that gets saved is
A:\qwer asdfghjk zxcvbnm 07_02_2019 Mobile and Excel 2007.xlsm
and that is well under the max length. Finally, even if the path was not mapped and I wanted to save directly to the sharepoint, the path is only 233 at it's longest.
Anyone have thoughts? googleing this is near impossible because I dont think the path error is accurate even though that's whats getting reported.
Code:
Private Sub SaveBothVersions(FirstAvailableNetworkDrive As String, SecondAvailableNetworkDrive As String)
'Retrieve ActiveWorkbook's File Path (Displayed in Immediate Window [ctrl + g])
strFileFullName = ThisWorkbook.FullName
'Retrieve File Name with Extension
nameExtension = Right(strFileFullName, Len(strFileFullName) - InStrRev(strFileFullName, "\"))
'Retrieve File Name without Extension
nameNoExtension = Mid(strFileFullName, InStrRev(strFileFullName, "\") + 1, InStrRev(strFileFullName, ".") - InStrRev(strFileFullName, "\") - 1)
'Create full path to save down
standardFile = FirstAvailableNetworkDrive & nameExtension
mobileFile = SecondAvailableNetworkDrive & nameNoExtension & " Mobile and Excel 2007.xlsm"
'Save current version
ThisWorkbook.Save
'Save standard file to sharepoint
[U][B]ThisWorkbook.SaveAs standardFile[/B][/U]
'Delete slicers and save mobile version to sharepoint
ThisWorkbook.SaveAs mobileFile
Call DeleteSlicers
ThisWorkbook.Save
End Sub