Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default 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" wrote in message
...
|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
|
|


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default 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" wrote in message
...
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" wrote in message
...
|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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default api fileopen dialog - lpstrFile size limitation?


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


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=480941

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default api fileopen dialog - lpstrFile size limitation?


Hello Mike,

Here are the limits...

When selecting multiple files, the total character limit for the fil
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 buffe
isn't large enough. The 2 lower bytes of lpstrFile hold the neede
buffer size.

Sincerely,
Leith Ros

--
Leith Ros
-----------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...fo&userid=1846
View this thread: http://www.excelforum.com/showthread.php?threadid=48094



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel file size limitation Stew_Katz Excel Discussion (Misc queries) 5 April 10th 10 07:45 AM
Userform size limitation Michael Harrer Excel Programming 0 July 9th 04 12:48 PM
Array size limitation? QuocAnh Excel Programming 9 November 21st 03 11:34 PM
Selecting a file path in Excel VBA using FileOpen dialog John Robinson Excel Programming 1 November 1st 03 09:59 AM
SheetSelectionChange Target size Limitation? Guillaume E. Excel Programming 1 September 27th 03 04:34 PM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"