Results 1 to 5 of 5

Thread: [RESOLVED] Vb6 - shellexecute doesnt like "&"

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2006
    Location
    Paris
    Posts
    301

    Resolved [RESOLVED] Vb6 - shellexecute doesnt like "&"

    Hi

    I was trying to send an email thru shellexecute and I found out that if the text being sent contains a "&", shellexecute will just stop reading beyond &.
    I don't know why (Im not familiar with shellexecute)

    In my particular case, the example is:

    ShellExecute 0&, vbNullString, emailaddress & "?subject=" & MailSub.TEXT & "&body=" & Replace(MailTEXT.TEXT, vbCrLf, "%0A"), vbNullString, vbNullString, SW_SHOWNORMAL

    I thought it could be useful to know for other VB6 users too.

    Regards


    Horazio

  2. #2
    Wall Poster TysonLPrice's Avatar
    Join Date
    Sep 2002
    Location
    Columbus, Ohio
    Posts
    3,836

    Re: Vb6 - shellexecute doesnt like "&"

    This:

    MailSub.TEXT & "&body=" & Replace

    Seems like it would be

    MailSub.TEXT&body=Replace

    With what ever was in mailsub.text and the Replace(MailTEXT.TEXT, vbCrLf, "%0A"),

    So If mailsub.text was XXXX and Replace(MailTEXT.TEXT, vbCrLf, "%0A") was ZZZ it would be

    XXX&bodyZZZZ

    Was that intentional?

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2006
    Location
    Paris
    Posts
    301

    Re: Vb6 - shellexecute doesnt like "&"

    mailsub.text and mailtext.text ar both standard text controls

    mailsub.text contains the title/object of the email

    mailtext.text is the email message, if there is a "&" shellexecute will stop until it finds this character

  4. #4
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,537

    Re: Vb6 - shellexecute doesnt like "&"

    it's not shellexecute that doesn't like it... it'll happily take what you send it... the thing is, what you're executing is essentially a URL using the mailto protocol instead of the http one... which means everything you send over on the URL has to be URLEncoded... and there are classes, functions & APIs to help with that. Search for URLEncode VB6 ... that should tunr up a few results, including a few right here in VBF.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2006
    Location
    Paris
    Posts
    301

    Re: Vb6 - shellexecute doesnt like "&"

    Thanks Technome

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width