#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default msbbox

i ran into a minor problem with a message box that was
too big to fit the screen due to the following program:

For i = 1 To .FoundFiles.Count
msg = msg & vbCr & .FoundFiles(i)
Next i
MsgBox("Found File '" & .Filename & "' with "
& .FoundFiles.Count & " file(s) in it." & Chr(10) & Chr
(10) & Replace(Replace(msg, Range("q263") & Range("q262")
& "\", ""), ".xls", "") & Chr(10) & Chr(10) & "Would you
like to save in the file?", vbYesNoCancel +
vbExclamation, "Existing File Found")

the file had 72 files in it and therefore
the 'yes' 'no' 'cancel' were off the page (youll note
that 'msg' adds a row for every file found). i would like
to have the message box list the foundfiles in columns of
20 names each but am not sure how to do it. if there is
no easy way, how do i set the maximum amount on the list
to like 50 or so?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 172
Default msbbox

To create more than one column you'll need to build the MsgBox string up
controlling the insertion of the Chr(10) which produces a new line. However
since you may not have control over the directory and hence the number of
files, even limiting it to two or more columns may not be enough, then you
might run out of page width!. To limit it to 20 means restricting the loop
that builds the msg string, but how will you know that the one the user
wants is listed, to show all means stepping though a series of MsgBoxes
which from an interface perspective is both cumbersome and error prone.

I recommend that you use the Application.GetSaveAsFilename built in xLDialog
to allow the user to browse for the file to save to. See VBA help for the
detail.

If you need the code to do this post again

Cheers
Nigel





"lawson" wrote in message
...
i ran into a minor problem with a message box that was
too big to fit the screen due to the following program:

For i = 1 To .FoundFiles.Count
msg = msg & vbCr & .FoundFiles(i)
Next i
MsgBox("Found File '" & .Filename & "' with "
& .FoundFiles.Count & " file(s) in it." & Chr(10) & Chr
(10) & Replace(Replace(msg, Range("q263") & Range("q262")
& "\", ""), ".xls", "") & Chr(10) & Chr(10) & "Would you
like to save in the file?", vbYesNoCancel +
vbExclamation, "Existing File Found")

the file had 72 files in it and therefore
the 'yes' 'no' 'cancel' were off the page (youll note
that 'msg' adds a row for every file found). i would like
to have the message box list the foundfiles in columns of
20 names each but am not sure how to do it. if there is
no easy way, how do i set the maximum amount on the list
to like 50 or so?



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



All times are GMT +1. The time now is 07:28 AM.

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

About Us

"It's about Microsoft Excel"