Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 19th, 2007, 05:31 AM
Registered User
 
Join Date: Aug 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Unable so assign value to .Lookin Property

Hi Everyone,

My first post on here... I've tried asking this question in a forum on another website but no one managed to suggest a solution.

Excel 2003 VBA

I've taken a simple procedure from the VBA helpfiles but I can't seem to get it to work properly.


Code:
Sub foo()
    Dim fs As FileSearch, i As Integer

    Set fs = Application.FileSearch
    With fs
        .LookIn = "U:\Calls"
        .Filename = "Tass*"

        Debug.Print .LookIn

        If .Execute(SortBy:=msoSortByFileName, _
                SortOrder:=msoSortOrderAscending) > 0 Then
            MsgBox "There were " & .FoundFiles.Count & _
                " file(s) found."
            For i = 1 To .FoundFiles.Count
                MsgBox .FoundFiles(i)
            Next i
        Else
            MsgBox "There were no files found."
        End If
    End With

    Set fs = Nothing
End Sub

I wondered why it could not find any files so I added the Debug.Print .LookIn line and this informs me that the value of the lookin property is "C:\My Documents".

There are other workarounds (filesystemobject) which will allow me to achieve what I need to, but I am frustrated that this does not work!! Are there any settings I need to be aware of which determine whether or not you can assign a value to this property?

Thanks in advance for your help.



 
Old August 24th, 2007, 03:16 PM
Registered User
 
Join Date: Aug 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi all,

Just for your reference I have solved this mystery...

It was not an excel issue - the problem was being caused by cross-domain privileges.

Regards







Similar Threads
Thread Thread Starter Forum Replies Last Post
Can you Assign a Collection to a Property? MandMD2 Beginning VB 6 2 May 3rd, 2007 05:24 PM
"Unable to set the FormulaArray property..." rduncan1 Excel VBA 2 August 18th, 2006 01:33 PM
Unable to set image or cursor property, Ch 12. VictorVictor BOOK: Beginning CSS: Cascading Style Sheets for Web Design ISBN: 978-0-7645-7642-3 5 April 26th, 2006 10:49 AM
Unable to assign string length of more than 256 rahulpokharna SQL Server 2000 3 January 12th, 2006 04:58 PM
ERROR: "property access must assign to the proper" anpham ASP.NET 1.0 and 1.1 Basics 2 July 1st, 2005 02:25 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.