Hyperlink Error in Excel when using #


C

CerealKiller

Hi there!

I've been working on a macro in Excel that creates hyperlinks to files in a
folder. The macro works fine, but I found that Excel can't manage hyperlinks
when the folder name begins with"#" and it's located in the root directory.
Something like this

"D:\# DBs Nielsen"

would cause Excel to generate an invalid hyperlink.
I've checked and it's not a macro bug, Excel can't seem to work with that
character.

Anyone knows how to fix this? I really would like to solve this without
changing the folder name as it's a shared server folder.

THX in advance
 
Ad

Advertisements

C

CerealKiller

THX, but that is a little depressing.

Is there any alternative to hyperlink when using macros?
Something like FILE in http.

THX again
 
D

Dave Peterson

You could open the file directly:

Option Explicit
Sub testme()
Dim wkbk As Workbook

Set wkbk = Nothing
On Error Resume Next
Set wkbk = Workbooks.Open("d:\# DBs Nielsen.xls")
On Error GoTo 0

If wkbk Is Nothing Then
Beep
MsgBox "not found"
End If

End Sub
 
J

JE McGimpsey

Depends on what you're trying to do - you can use Workbooks.Open if the
file is an XL Workbook. There are various ways to open text files or
other Office document types.


Your example doesn't really specify.

OTOH, I'd really suggest avoiding reserved URI characters in file
paths...
 
Ad

Advertisements

C

CerealKiller

Thank You both.

I wanted to create an automated directory in excel with hyperlinks linking
the files.
Some people is always asking where some file is located. So I wanted to make
things a easier for computer-handycapped people ;)

THX again
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top