ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   MsgBox (https://www.excelbanter.com/excel-programming/294274-msgbox.html)

Lawson

MsgBox
 
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")


Bob Phillips[_6_]

MsgBox
 
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)

"Lawson" wrote in message
...
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")




Patrick Molloy

MsgBox
 
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

"Lawson" wrote in message
...
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")





All times are GMT +1. The time now is 09:01 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com