Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default Number / Pound sign problem

I use the code below to pull in a list of all files in the same folder as the
file that contains the macro and then give a hyperlink to each of those
files. It works like a TOP as long as there isn't a Number symbol "#" in the
file name??? Then the file is still listed and formatted as a link but the
hyperlink doesn't work.

I thought maybe it was because it wasn't a letter or number but that is the
only character I have found that won't work.

Could anyone possibly help me with a fix or at least an explanation of why
only that one doesnt work?


Dim i As Integer
Dim myF As String

With Application.FileSearch
..NewSearch
..LookIn = Range("b2").Value
..SearchSubFolders = True
..MatchTextExactly = False
..FileType = msoFileTypeAllFiles
If .Execute(msoSortOrderDescending) 0 Then
MsgBox "There were " & .FoundFiles.Count & " file(s) found."
For i = 1 To .FoundFiles.Count

myF = Mid(.FoundFiles(i), InStrRev(.FoundFiles(i), "\") + 1)
myF = Left(myF, Len(myF) - 4)
ActiveCell.Cells(i, 1).FormulaR1C1 = "=HYPERLINK(""" & .FoundFiles(i) &
""",""" & myF & """)"
Next i
Else
MsgBox "There were no files found."
End If
--
THANKS!

Steve
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 638
Default Number / Pound sign problem

VBA treats the pund sign as a wilcard for a numeric value. I'll bet
that is what is causing the problem. It probably won't work with
question marks and asterisks either.
Steve_n_KC wrote:
I use the code below to pull in a list of all files in the same folder as the
file that contains the macro and then give a hyperlink to each of those
files. It works like a TOP as long as there isn't a Number symbol "#" in the
file name??? Then the file is still listed and formatted as a link but the
hyperlink doesn't work.

I thought maybe it was because it wasn't a letter or number but that is the
only character I have found that won't work.

Could anyone possibly help me with a fix or at least an explanation of why
only that one doesnt work?


Dim i As Integer
Dim myF As String

With Application.FileSearch
.NewSearch
.LookIn = Range("b2").Value
.SearchSubFolders = True
.MatchTextExactly = False
.FileType = msoFileTypeAllFiles
If .Execute(msoSortOrderDescending) 0 Then
MsgBox "There were " & .FoundFiles.Count & " file(s) found."
For i = 1 To .FoundFiles.Count

myF = Mid(.FoundFiles(i), InStrRev(.FoundFiles(i), "\") + 1)
myF = Left(myF, Len(myF) - 4)
ActiveCell.Cells(i, 1).FormulaR1C1 = "=HYPERLINK(""" & .FoundFiles(i) &
""",""" & myF & """)"
Next i
Else
MsgBox "There were no files found."
End If
--
THANKS!

Steve


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default Number / Pound sign problem

Thats basically what I thought was happening but I was hoping that there
might be a work around for the # since it is actually allowed in the file
names. * and ? are never an issue because none of the applications that we
use will allow them to be used in a file name.


--
THANKS!

Steve


"JW" wrote:

VBA treats the pund sign as a wilcard for a numeric value. I'll bet
that is what is causing the problem. It probably won't work with
question marks and asterisks either.
Steve_n_KC wrote:
I use the code below to pull in a list of all files in the same folder as the
file that contains the macro and then give a hyperlink to each of those
files. It works like a TOP as long as there isn't a Number symbol "#" in the
file name??? Then the file is still listed and formatted as a link but the
hyperlink doesn't work.

I thought maybe it was because it wasn't a letter or number but that is the
only character I have found that won't work.

Could anyone possibly help me with a fix or at least an explanation of why
only that one doesnt work?


Dim i As Integer
Dim myF As String

With Application.FileSearch
.NewSearch
.LookIn = Range("b2").Value
.SearchSubFolders = True
.MatchTextExactly = False
.FileType = msoFileTypeAllFiles
If .Execute(msoSortOrderDescending) 0 Then
MsgBox "There were " & .FoundFiles.Count & " file(s) found."
For i = 1 To .FoundFiles.Count

myF = Mid(.FoundFiles(i), InStrRev(.FoundFiles(i), "\") + 1)
myF = Left(myF, Len(myF) - 4)
ActiveCell.Cells(i, 1).FormulaR1C1 = "=HYPERLINK(""" & .FoundFiles(i) &
""",""" & myF & """)"
Next i
Else
MsgBox "There were no files found."
End If
--
THANKS!

Steve



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
change from dollars to pound sign on balance sheets putters New Users to Excel 1 January 10th 08 11:51 AM
replace this Å“ character with pound sign in excel r1947 Excel Discussion (Misc queries) 4 April 7th 07 06:30 AM
Cant make (£) Pound sign in Excel!? paperclip Excel Discussion (Misc queries) 3 March 15th 06 09:51 AM
UK Pound Sign Owen Excel Discussion (Misc queries) 4 August 22nd 05 05:53 PM
Pound Sign (£) being swithed to (ú) character stephen Excel Discussion (Misc queries) 0 May 10th 05 06:52 PM


All times are GMT +1. The time now is 10:02 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"