Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

error 'Cannot open the specified file' in Excel using Hyperlink

Status
Not open for further replies.

Nifrabar

Programmer
Mar 16, 2003
1,343
NL
Hi!
I am having a hyperlink like:
\\dsgnt\ce\Bouwnummers\549601\Index\400\BvS\214 Straathof Prop Engine Controls\549601-214-001 Straathof WT Joystick [genge & Thoma sk_60].pdf

Than I get error 'Cannot open the specified file'.
Some people say that filename is too long.
When I rename 549601-214-001 Straathof WT Joystick [genge & Thoma sk_60].pdf into x1.pdf the hyperlink works fine.

\\dsgnt\ce\Bouwnummers\549601\Index\400\BvS\214 Straathof Prop Engine Controls\x1.pdf

But I don't want to change the original file-name.

Any idea how to fix this?

TIA
-Bart
 
141 characters is unlikely to be a length problem - you begin to get them at 255 characters. Is it the square brackets perhaps?

Gavin
 
Hi Gavin,
I followed your advice and indeed by replacing the square brackets with a dash the error is gone.
But nevertheless I don't want to change the file name (as file is stored somewehere else also).
Any suggestion?
-Bart
 
Hi,
I think you would do best to change the filename to remove the [ ].
If you really can't do this then:
You could try creating a shortcut to the file (from within the windows explorer), then link to the shortcut. This may help you to open it but you may have issues if you want to save it with the same name.
One of the links below suggests that using VBA to save the file may not involve the same validation processes so might enable you to save a file with those invalid characters.
What (if anything) works may depend on the version of excel that you are using.

Let us know what you conclude.

My research:
In excel 2003 if you try to save a file with a name including [] you get an error message that is worth reading in this context:
File/folder name cannot be more than 218 characters and may not contain:
< > ? [ ] : | or *

I tried changing a file name to include [] and found that Excel could open and save it fine BUT if you choose File Save As for that file then the square brackets got converted to normal brackets....
I came across this from Microsoft but it does not relate to more recent products:

This link gives info on filepath/name length limitations
(Though this does not accord with the text of the error message I got referring to 218 characters for xl2003)
Another link


Gavin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top