MsgBox

L

Lawson

rather than tinker around for hours trying to figure how
to get this expression to work, i was hoping that someone
with more experience could show me how its done. I want
the message to say "Found files blah blah blah...:" then
list each file it found below, each file found getting
its own line in the msgbox. my method below has multiple
syntax errors that i havnt been able to get around:

MsgBox("Found File '" & .Filename & "' with "
& .FoundFiles.Count & " file(s) in it." & Chr(10) & _
For i = 1 To .FoundFiles.Count
.FoundFiles (i) & Chr(10)
Next i & _
Chr(10) & "Would you like to save in the file?",
vbYesNoCancel + vbExclamation, "Existing File Found")
 
B

Bob Phillips

sMsg = ""
For i = 1 To .FoundFiles.Count
sMsg = .FoundFiles (i) & vbcrlf
Next i

ans = MsgBox (.FoundFiles.Count & " file(s) found." & Chr(10) & _
sMsg & _
"Would you like to save in the file?", _
vbYesNoCancel + vbExclamation, "Existing File
Found")

If ans = vbYes Then
' etc.


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
P

Patrick Molloy

DIM msg As String
For i = 1 To .FoundFiles.Count
msg = msg & vbcr &.FoundFiles (i)
Next i

msg = "Found: & vbcr & msg

If msgbox( msg, vbYesNo, "Save Found Files?" ) = vbYes Then
' you code here...
End If


Patrick Molloy
Microsoft Excel MVP
 
Top