Solved

Override for 218 character limit for filename & path when saving through VBA

Posted on 2016-08-26
4
78 Views
Last Modified: 2016-08-26
I have a macro that publishes a PDF file and saves it to a shared directory. The filepath is quite long and I often run into the situation where the filename and path exceed the 218 character limit set in Excel. Is there a workaround for this? I am unable to use relative paths since this will be used by multiple users that may have the drives mapped differently.
0
Comment
Question by:James Talvy
4 Comments
 
LVL 49

Expert Comment

by:Rgonzo1971
ID: 41771772
Hi,

It doesn't seem possible
https://support.microsoft.com/en-us/kb/213983

Regards
0
 
LVL 1

Expert Comment

by:ltpitt
ID: 41771819
Change the file naming policy, I do not see many other solutions
0
 
LVL 93

Expert Comment

by:John Hurst
ID: 41771866
DON'T.  Shorten the filenames, else you be back saying something else does not work. Filenames that are too long is a universally bad idea.
0
 
LVL 37

Accepted Solution

by:
bbao earned 500 total points
ID: 41771987
it is always a good practice to define a relatively short, still meaningful convention for naming long filenames and folder names.

however, as a spare solution you may consider using SHORTENED version of filenames, the traditional 8.3 naming convention, instead of the long version in your VBA code.

foe example, use C:\PROGRA~1\ instead of C:\Program Files\, this may significantly reduce the string length for accessing a pathname.

FYI -

How to Find 8.3 Filenames
http://superuser.com/questions/348079/how-can-i-find-the-short-path-of-a-windows-directory-file

How Windows Generates 8.3 Filenamea from Long Filenames
https://support.microsoft.com/en-us/kb/142982
0

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Possible fixes for Windows 7 and Windows Server 2008 updating problem. Solutions mentioned are from Microsoft themselves. I started a case with them from our Microsoft Silver Partner option to open a case and get direct support from Microsoft. If s…
When you try to extract and to view the contents of a Microsoft Update Standalone Package (MSU) for Windows Vista, you cannot extract the files from the MSU. Here we are going to explain how to extract those hotfix details without using any third pa…
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question