Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ShellExecute or string definition ?

Status
Not open for further replies.

dominiopt

Technical User
Sep 10, 2001
75
PT
Hi everybody in the following piece of code after several mail addresses combined in message (String) the ShellExecute don't launch as expected the mail software, like he does for few items.

The problem must be in ShellExecute or in String variable definition String (fixed-length) or String (variable-length), in last case how can i change fixed for variable length.

Dim message As String

Set rs = db.OpenRecordset(sSQL)
Do While Not rs.EOF
message = message & "; " & rs.Fields("ref11")
rs.MoveNext
Loop
rs.Close

ShellExecute Me.hwnd, "open", "mailto:?bcc=" & message, "", "", "1"

Any help will be very appreciated.
Thanks

Fernando
 
Try doing something like this:
Code:
  Dim bFirst As Boolean

  bFirst = True

  Do While Not rs.EOF
    If bFirst Then
      message = rs.Fields("ref11").Value
      bFirst = False
    Else
      message = message & "; " & rs.Fields("ref11").Value
    End If
    rs.MoveNext
  Loop

Otherwise your email address is starting with a semi-colon, which could cause problems.

Chip H.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top