+ Reply to Thread
Results 1 to 2 of 2

[SOLVED] Shell Object Not Working Right In XL2000, But No Errors

  1. #1
    MDW
    Guest

    [SOLVED] Shell Object Not Working Right In XL2000, But No Errors

    I'm adding code to a workbook that will be used by Excel 2000 (on Win2K) and
    Excel 2003 (on WinXP). The following code works fine in XL2003, but not in
    XL2000.



    Set objShell = CreateObject("Shell.Application")
    Set objNS = objShell.Namespace(strFolderPath)

    ' Step through all the files in the current folder
    For Each objF In objNS.Items

    ' GetDetailsOf exposes the summary information about the file. #12 is
    the Category
    If objNS.GetDetailsOf(objF, 12) = "myfile" Then

    ' Do stuff

    End If

    Next



    When I step through the code in XL2000, I see that the objF objects are
    recognized - I can hover the cursor over them and see the file/folder name as
    the loop progresses. However, the statement "objNS.GetDetailsOf(objF, 12)"
    returns a zero-length string in XL2000. In XL2003, it returns the "Category"
    in the file's summary information. It does NOT, however, generate any error
    messages in XL2000.

    Is there something different I need to do for this code to work in XL2000?



    --
    Hmm...they have the Internet on COMPUTERS now!

  2. #2
    NickHK
    Guest

    Re: Shell Object Not Working Right In XL2000, But No Errors

    Not sure what the problem is, but as these are not Excel's objects, any
    difference is probably down to the OS
    For my W2K, I get valid responses for indices 0-8, all higher values
    returning Empty.
    It would appear that info such as "Category" cannot be returned from a
    folder like this.
    Have you looked in "Streams" ?

    NickHK

    "MDW" <[email protected]> wrote in message
    news:[email protected]...
    > I'm adding code to a workbook that will be used by Excel 2000 (on Win2K)

    and
    > Excel 2003 (on WinXP). The following code works fine in XL2003, but not in
    > XL2000.
    >
    >
    >
    > Set objShell = CreateObject("Shell.Application")
    > Set objNS = objShell.Namespace(strFolderPath)
    >
    > ' Step through all the files in the current folder
    > For Each objF In objNS.Items
    >
    > ' GetDetailsOf exposes the summary information about the file. #12 is
    > the Category
    > If objNS.GetDetailsOf(objF, 12) = "myfile" Then
    >
    > ' Do stuff
    >
    > End If
    >
    > Next
    >
    >
    >
    > When I step through the code in XL2000, I see that the objF objects are
    > recognized - I can hover the cursor over them and see the file/folder name

    as
    > the loop progresses. However, the statement "objNS.GetDetailsOf(objF,

    12)"
    > returns a zero-length string in XL2000. In XL2003, it returns the

    "Category"
    > in the file's summary information. It does NOT, however, generate any

    error
    > messages in XL2000.
    >
    > Is there something different I need to do for this code to work in XL2000?
    >
    >
    >
    > --
    > Hmm...they have the Internet on COMPUTERS now!




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1