+ Reply to Thread
Results 1 to 6 of 6

api fileopen dialog - lpstrFile size limitation?

Hybrid View

  1. #1
    Mike Weaver
    Guest

    api fileopen dialog - lpstrFile size limitation?

    I am using Excel to call the win api openfile dialog with the
    OFN_ALLOWMULTISELECT flag set (I am selecting multiple files).

    Everything works fine until I select too many files, then my function
    returns nothing:-(

    I have tried increasing the size of the string buffer:
    udtStruct.lpstrFile = String(400#, 32)
    which runs, but doesn't increase the number of files I can select. Nothing
    above about 254 seems to make a difference.

    Is this a limitation I am going to have to live with?

    Thanks in advance,
    Mike Weaver



  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259
    Hello Mike,

    Here are the limits...

    When selecting multiple files, the total character limit for the file names depends on the operating system and the version of the function.

    Windows 95/98/Me: (only ANSI is supported) no restriction
    Microsoft Windows NT4 and earlier: 32k limit
    Windows 2000/XP: (ANSI) 32k limit, (Unicode) no restriction

    If your function is returning a empty string (""), then your buffer isn't large enough. The 2 lower bytes of lpstrFile hold the needed buffer size.

    Sincerely,
    Leith Ross
    Last edited by Leith Ross; 11-01-2005 at 10:07 PM.

  3. #3
    Jim Rech
    Guest

    Re: api fileopen dialog - lpstrFile size limitation?

    Any reason not to use the MultiSelect parameter of the
    Application.GetOpenFilename method?

    Anyway, with this:

    OpenFile.lpstrFile = String(25000, 0)

    I got 156 files (all I selected) into an array:

    Dim FileArray as Variant

    FileArray = Split(OpenFile.lpstrFile, Chr(0))

    --
    Jim
    "Mike Weaver" <mikeweaver_ak@hotmail.com> wrote in message
    news:OEqRt6x3FHA.1140@tk2msftngp13.phx.gbl...
    |I am using Excel to call the win api openfile dialog with the
    | OFN_ALLOWMULTISELECT flag set (I am selecting multiple files).
    |
    | Everything works fine until I select too many files, then my function
    | returns nothing:-(
    |
    | I have tried increasing the size of the string buffer:
    | udtStruct.lpstrFile = String(400#, 32)
    | which runs, but doesn't increase the number of files I can select.
    Nothing
    | above about 254 seems to make a difference.
    |
    | Is this a limitation I am going to have to live with?
    |
    | Thanks in advance,
    | Mike Weaver
    |
    |



  4. #4
    Mike Weaver
    Guest

    Re: api fileopen dialog - lpstrFile size limitation?

    <wiping egg from face.mpeg>
    Thanks, that does what I need.
    [pointing object browser to application object]


    "Jim Rech" <jrrech@hotmail.com> wrote in message
    news:uZxDCmy3FHA.636@TK2MSFTNGP10.phx.gbl...
    > Any reason not to use the MultiSelect parameter of the
    > Application.GetOpenFilename method?
    >
    > Anyway, with this:
    >
    > OpenFile.lpstrFile = String(25000, 0)
    >
    > I got 156 files (all I selected) into an array:
    >
    > Dim FileArray as Variant
    >
    > FileArray = Split(OpenFile.lpstrFile, Chr(0))
    >
    > --
    > Jim
    > "Mike Weaver" <mikeweaver_ak@hotmail.com> wrote in message
    > news:OEqRt6x3FHA.1140@tk2msftngp13.phx.gbl...
    > |I am using Excel to call the win api openfile dialog with the
    > | OFN_ALLOWMULTISELECT flag set (I am selecting multiple files).
    > |
    > | Everything works fine until I select too many files, then my function
    > | returns nothing:-(
    > |
    > | I have tried increasing the size of the string buffer:
    > | udtStruct.lpstrFile = String(400#, 32)
    > | which runs, but doesn't increase the number of files I can select.
    > Nothing
    > | above about 254 seems to make a difference.
    > |
    > | Is this a limitation I am going to have to live with?
    > |
    > | Thanks in advance,
    > | Mike Weaver
    > |
    > |
    >
    >




  5. #5
    Jim Rech
    Guest

    Re: api fileopen dialog - lpstrFile size limitation?

    Any reason not to use the MultiSelect parameter of the
    Application.GetOpenFilename method?

    Anyway, with this:

    OpenFile.lpstrFile = String(25000, 0)

    I got 156 files (all I selected) into an array:

    Dim FileArray as Variant

    FileArray = Split(OpenFile.lpstrFile, Chr(0))

    --
    Jim
    "Mike Weaver" <mikeweaver_ak@hotmail.com> wrote in message
    news:OEqRt6x3FHA.1140@tk2msftngp13.phx.gbl...
    |I am using Excel to call the win api openfile dialog with the
    | OFN_ALLOWMULTISELECT flag set (I am selecting multiple files).
    |
    | Everything works fine until I select too many files, then my function
    | returns nothing:-(
    |
    | I have tried increasing the size of the string buffer:
    | udtStruct.lpstrFile = String(400#, 32)
    | which runs, but doesn't increase the number of files I can select.
    Nothing
    | above about 254 seems to make a difference.
    |
    | Is this a limitation I am going to have to live with?
    |
    | Thanks in advance,
    | Mike Weaver
    |
    |



  6. #6
    Mike Weaver
    Guest

    Re: api fileopen dialog - lpstrFile size limitation?

    <wiping egg from face.mpeg>
    Thanks, that does what I need.
    [pointing object browser to application object]


    "Jim Rech" <jrrech@hotmail.com> wrote in message
    news:uZxDCmy3FHA.636@TK2MSFTNGP10.phx.gbl...
    > Any reason not to use the MultiSelect parameter of the
    > Application.GetOpenFilename method?
    >
    > Anyway, with this:
    >
    > OpenFile.lpstrFile = String(25000, 0)
    >
    > I got 156 files (all I selected) into an array:
    >
    > Dim FileArray as Variant
    >
    > FileArray = Split(OpenFile.lpstrFile, Chr(0))
    >
    > --
    > Jim
    > "Mike Weaver" <mikeweaver_ak@hotmail.com> wrote in message
    > news:OEqRt6x3FHA.1140@tk2msftngp13.phx.gbl...
    > |I am using Excel to call the win api openfile dialog with the
    > | OFN_ALLOWMULTISELECT flag set (I am selecting multiple files).
    > |
    > | Everything works fine until I select too many files, then my function
    > | returns nothing:-(
    > |
    > | I have tried increasing the size of the string buffer:
    > | udtStruct.lpstrFile = String(400#, 32)
    > | which runs, but doesn't increase the number of files I can select.
    > Nothing
    > | above about 254 seems to make a difference.
    > |
    > | Is this a limitation I am going to have to live with?
    > |
    > | Thanks in advance,
    > | Mike Weaver
    > |
    > |
    >
    >




+ 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