Power Query Course in Spanish
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 3 of 3

Thread: Application.Filesearch defaults to My Documents

  1. #1
    New Member
    Join Date
    Apr 2002
    Location
    India
    Posts
    5
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hi,
    I have a piece of code which look like this:
    ******************
    With Application.FileSearch
    .LookIn = strFolder
    .SearchSubFolders = False
    .............
    ******************
    if the strfolder is a network folder on which I dont have any access the .LookIn always defaults to "My Documents" . Does anybody have a workaround?

    Thanks,
    Anoop

  2. #2
    MrExcel MVP Ivan F Moala's Avatar
    Join Date
    Feb 2002
    Location
    Auckland, New Zealand
    Posts
    4,209
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    On 2002-04-24 05:23, anoopr wrote:
    Hi,
    I have a piece of code which look like this:
    ******************

    .............
    ******************
    if the strfolder is a network folder on which I dont have any access the .LookIn always defaults to "My Documents" . Does anybody have a workaround?

    Thanks,
    Anoop
    Test if Dir access is OK then use the Chdir
    function to default to the Dir you want.

    eg


    If Dir(StrFolder) <> "" Then StrFolder = "C:"
    With Application.FileSearch
    .LookIn = StrFolder
    .SearchSubFolders = False
    End With



    Kind Regards,
    Ivan F Moala From the City of Sails

  3. #3
    New Member
    Join Date
    Apr 2002
    Location
    India
    Posts
    5
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    I'd wanted an error to be raised when the folder specified in .LookIn could not be accessed. Is there any way to achieve this?

    Thanks,
    Anoop

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •