"lst" file does not work

G

Guest

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****
 
D

Doug Glancy

maperalia,

When I do it, the links are created and they work The files are opened in
Visual Studio, and I'm prompted twice whether I really want to open them but
they do open. I'm using XL 2003, Win XP.

hth,

Doug
 
G

Guest

Doug;
Thank for your quick response;
When I run the program the hyperlinks are created too. However, when I click
on them I have nothing. No file is opened!
In addtion, I need to open these hyperlinks in excel to have the option to
import the text in the way I have shown you in my previous message. I'm using
XL 2003, Win XP too.

Do you think there is a way to add a statement to add this TEST IMPORT
WIZARD?.

Thanks in advance.
Maperalia
 
T

Tom Ogilvy

You will probably have to have the link link to the cell that contains the
hyperlink. Then use the followhyperlink event to open the file with the
Opentext method.
 
G

Guest

Tom;
Thanks for your advice but I did not follow it very well. Could you please
explain me that in other way.

Thanks.
Maperalia
 

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