ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   "lst" file does not work (https://www.excelbanter.com/excel-programming/358938-lst-file-does-not-work.html)

maperalia

"lst" file does not work
 
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****


Doug Glancy

"lst" file does not work
 
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


"maperalia" wrote in message
...
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****




maperalia

"lst" file does not work
 
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


"Doug Glancy" wrote:

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


"maperalia" wrote in message
...
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****





Tom Ogilvy

"lst" file does not work
 
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.

--
Regards,
Tom Ogilvy

"maperalia" wrote in message
...
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


"Doug Glancy" wrote:

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


"maperalia" wrote in message
...
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****







Doug Glancy

"lst" file does not work
 
maperalia,

I'm sorry, I don't know the answer to your question.

Doug


"maperalia" wrote in message
...
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


"Doug Glancy" wrote:

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


"maperalia" wrote in message
...
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****







maperalia

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

Thanks.
Maperalia


"Tom Ogilvy" wrote:

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.

--
Regards,
Tom Ogilvy

"maperalia" wrote in message
...
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


"Doug Glancy" wrote:

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


"maperalia" wrote in message
...
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****








maperalia

"lst" file does not work
 
Thanks very much for time Doug!. I really appreciatte it.

Maperalia

"Doug Glancy" wrote:

maperalia,

I'm sorry, I don't know the answer to your question.

Doug


"maperalia" wrote in message
...
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


"Doug Glancy" wrote:

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


"maperalia" wrote in message
...
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****









All times are GMT +1. The time now is 03:48 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com