ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Cannot assign value to Filesearch.Lookin (https://www.excelbanter.com/excel-programming/305568-cannot-assign-value-filesearch-lookin.html)

QQExcel

Cannot assign value to Filesearch.Lookin
 
Hello, everone,

I just posted this and something wrong w/ my computer, sorry if I post
it twice.

I have a problem with assiging file path to .LookIn. I saw couple
messages regard to it but still don't get it. Any help would
appreciate.

Here is my code:

FilePath = ThisWorkbook.Path & "\Phase1_Comments\"

Set FS = Application.FileSearch
With FS
.LookIn = """" & FilePath & """"
.FileName = FileSpec
.Execute
If .FoundFiles.Count = 0 Then
MsgBox "No files were found, ...."
Exit Sub
End If
End With

ThisWorkbook.Path is as http"//servername/.../
..LookIn is still as C:\documents and settings\ after running.

This code is in workbook event - SheetFollowHyperlink

My excel is 2000.

Thanks a lot!

Tom Ogilvy

Cannot assign value to Filesearch.Lookin
 
lose all the quotes. Filepath is already a string

.Lookin = filepath

--
Regards,
Tom Ogilvy

"QQExcel" wrote in message
om...
Hello, everone,

I just posted this and something wrong w/ my computer, sorry if I post
it twice.

I have a problem with assiging file path to .LookIn. I saw couple
messages regard to it but still don't get it. Any help would
appreciate.

Here is my code:

FilePath = ThisWorkbook.Path & "\Phase1_Comments\"

Set FS = Application.FileSearch
With FS
.LookIn = """" & FilePath & """"
.FileName = FileSpec
.Execute
If .FoundFiles.Count = 0 Then
MsgBox "No files were found, ...."
Exit Sub
End If
End With

ThisWorkbook.Path is as http"//servername/.../
.LookIn is still as C:\documents and settings\ after running.

This code is in workbook event - SheetFollowHyperlink

My excel is 2000.

Thanks a lot!




QQExcel

Cannot assign value to Filesearch.Lookin
 
Thanks Tom!

But it still doesn't work. Actually, I tried that first and then add
the quotes. Neither of them work.


Christine

"Tom Ogilvy" wrote in message ...
lose all the quotes. Filepath is already a string

.Lookin = filepath

--
Regards,
Tom Ogilvy

"QQExcel" wrote in message
om...
Hello, everone,

I just posted this and something wrong w/ my computer, sorry if I post
it twice.

I have a problem with assiging file path to .LookIn. I saw couple
messages regard to it but still don't get it. Any help would
appreciate.

Here is my code:

FilePath = ThisWorkbook.Path & "\Phase1_Comments\"

Set FS = Application.FileSearch
With FS
.LookIn = """" & FilePath & """"
.FileName = FileSpec
.Execute
If .FoundFiles.Count = 0 Then
MsgBox "No files were found, ...."
Exit Sub
End If
End With

ThisWorkbook.Path is as http"//servername/.../
.LookIn is still as C:\documents and settings\ after running.

This code is in workbook event - SheetFollowHyperlink

My excel is 2000.

Thanks a lot!


QQExcel

Cannot assign value to Filesearch.Lookin....still not working
 
I changed my code as following, but still nor working....

FilePath = ThisWorkbook.Path & "\Phase1_Comments\"

Set FS = Application.FileSearch
With FS
.LookIn = FilePath
.FileName = FileSpec
.Execute
If .FoundFiles.Count = 0 Then
MsgBox "No files were found, ...."
Exit Sub
End If
End With

ThisWorkbook.Path is as http"//servername/.../
.LookIn is still as C:\documents and settings\ after running.

Thanks a lot!

regards,
Christine

(QQExcel) wrote in message . com...
Hello, everone,

I just posted this and something wrong w/ my computer, sorry if I post
it twice.

I have a problem with assiging file path to .LookIn. I saw couple
messages regard to it but still don't get it. Any help would
appreciate.

Here is my code:

FilePath = ThisWorkbook.Path & "\Phase1_Comments\"

Set FS = Application.FileSearch
With FS
.LookIn = """" & FilePath & """"
.FileName = FileSpec
.Execute
If .FoundFiles.Count = 0 Then
MsgBox "No files were found, ...."
Exit Sub
End If
End With

ThisWorkbook.Path is as http"//servername/.../
.LookIn is still as C:\documents and settings\ after running.

This code is in workbook event - SheetFollowHyperlink

My excel is 2000.

Thanks a lot!



All times are GMT +1. The time now is 08:07 PM.

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