Solved

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

Posted on 2016-08-26
4
138 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 50

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 94

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

Manage your data center from practically anywhere

The KN8164V features HD resolution of 1920 x 1200, FIPS 140-2 with level 1 security standards and virtual media transmissions at twice the speed. Built for reliability, the KN series provides local console and remote over IP access, ensuring 24/7 availability to all servers.

Question has a verified solution.

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

Learn how to PXE Boot both BIOS & UEFI machines with DHCP Policies and Custom Vendor Classes
No single Antivirus application (despite claims by manufacturers) will catch or protect you from all Virus / Malware or Spyware threats. That doesn't stop you from further protecting yourself however - and this article is to show you how.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

726 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