M
maperalia
I have a program that make a list of "lst" under one directory and then
create a hyperlink for each one (see below). The program runs prefectly just
the hyperlinks do not work.
I am thinking that perhaps when I open the "lst" file in manually in excel I
got the TEXT IMPORT WIZARD window message that allow me to choose:
1.- In the first step DELIMITED.
2.- In the 2nd step SPACE ONLY
3.- In the trird step GENERAL.
Do you think is possible to adjust the hyperlink to read the step shown
above?.
Thanks in advance.
Maperalia
'****START PROGRAM****
Option Explicit
Sub List_lst_Files()
Dim FName As String
Dim r As Integer
Dim i As Long
Dim MyPath As String
Dim WO As String
Const strFileType As String = "lst"
With ActiveSheet.Columns(1)
..Hyperlinks.Delete
..ClearContents
End With
WO = Application.InputBox("Enter Work Order Number")
MyPath = "S:\test\locations\" & WO & "\"
On Error Resume Next
Worksheets("List of lst Files").Delete
On Error GoTo 0
Application.DisplayAlerts = True
Worksheets.Add.Name = "List of lst Files"
r = 2
With Application.FileSearch
.NewSearch
.LookIn = MyPath
.SearchSubFolders = True
.Filename = "*." & strFileType
If .Execute() > 0 Then
For i = 1 To .FoundFiles.Count
FName = Mid(.FoundFiles(i), 1)
Cells(r, 1) = Mid(FName, Len(MyPath) + 1, 255)
ActiveSheet.Hyperlinks.Add Anchor:=Cells(r, 1),
Address:=FName, TextToDisplay:=Cells(r, 1).Value
r = r + 1
Next i
End If
End With
ActiveSheet.Select
Range("A1").Select
End Sub
'****END PROGRAM****
create a hyperlink for each one (see below). The program runs prefectly just
the hyperlinks do not work.
I am thinking that perhaps when I open the "lst" file in manually in excel I
got the TEXT IMPORT WIZARD window message that allow me to choose:
1.- In the first step DELIMITED.
2.- In the 2nd step SPACE ONLY
3.- In the trird step GENERAL.
Do you think is possible to adjust the hyperlink to read the step shown
above?.
Thanks in advance.
Maperalia
'****START PROGRAM****
Option Explicit
Sub List_lst_Files()
Dim FName As String
Dim r As Integer
Dim i As Long
Dim MyPath As String
Dim WO As String
Const strFileType As String = "lst"
With ActiveSheet.Columns(1)
..Hyperlinks.Delete
..ClearContents
End With
WO = Application.InputBox("Enter Work Order Number")
MyPath = "S:\test\locations\" & WO & "\"
On Error Resume Next
Worksheets("List of lst Files").Delete
On Error GoTo 0
Application.DisplayAlerts = True
Worksheets.Add.Name = "List of lst Files"
r = 2
With Application.FileSearch
.NewSearch
.LookIn = MyPath
.SearchSubFolders = True
.Filename = "*." & strFileType
If .Execute() > 0 Then
For i = 1 To .FoundFiles.Count
FName = Mid(.FoundFiles(i), 1)
Cells(r, 1) = Mid(FName, Len(MyPath) + 1, 255)
ActiveSheet.Hyperlinks.Add Anchor:=Cells(r, 1),
Address:=FName, TextToDisplay:=Cells(r, 1).Value
r = r + 1
Next i
End If
End With
ActiveSheet.Select
Range("A1").Select
End Sub
'****END PROGRAM****