|
-
Jun 14th, 2004, 11:12 AM
#1
Thread Starter
Hyperactive Member
Shellexecute, Mailto and Attachment problem..
Hey All,
I'm using the following line of code:
Code:
ShellExecute 0&, vbNullString, "mailto:?subject=AXIAR Email" & _
"&Attach=" & Chr(34) & DataKeyPath & Chr(34), _
vbNullString, "C:\", vbNormal
And recieving the following error from outlook:
"Command Line argument not valid. Please verify the switch you are using".
Any ideas?
Thanks!
-
Jun 14th, 2004, 11:38 AM
#2
Lively Member
Re: Shellexecute, Mailto and Attachment problem..
Originally posted by BenFinkel
Hey All,
I'm using the following line of code:
Code:
ShellExecute 0&, vbNullString, "mailto:?subject=AXIAR Email" & _
"&Attach=" & Chr(34) & DataKeyPath & Chr(34), _
vbNullString, "C:\", vbNormal
And recieving the following error from outlook:
"Command Line argument not valid. Please verify the switch you are using".
Any ideas?
Thanks!
You can try adding the email address right before the "?", see if that helps.
-
Jun 14th, 2004, 12:15 PM
#3
Thread Starter
Hyperactive Member
Tried that, no luck. I also tried "attachment" versus "attach". I'm using outlook 2003, if that makes any difference.
Thanks,
Ben
-
Jun 14th, 2004, 12:18 PM
#4
VB Code:
ShellExecute 0&, vbNullString, "mailto:?subject=AXIAR Email&attach=" & Chr(34) & "C:\boot.ini" & Chr(34), vbNullString, "C:\", vbNormal
This worked fine, except it didn't attach a file.
Related topics:
http://www.vbforums.com/showthread.p...o+shellexecute
http://www.vbforums.com/showthread.p...o+shellexecute
-
Jun 14th, 2004, 12:34 PM
#5
I'm not sure, but I think you need to url encode it in order for it to work right. Meaning spaces get converted to %20, I'm guessign the : and \ also need to be converted accordingly.
TG
-
Jun 14th, 2004, 01:10 PM
#6
Ah yes, I completely forgot about that. This is my old and slow, but working encoder...
VB Code:
Function URLencode(Text As String) As String
Dim A As Long, Temp As String
For A = 1 To Len(Text)
Temp = Temp & "%" & Right$("0" & Hex$(Asc(Mid$(Text, A, 1))), 2)
Next A
URLencode = Temp
End Function
And use like:
..."&attach=" & Chr$(34) & URLencode(Filename) & Chr$(34)...
-
Jun 14th, 2004, 01:34 PM
#7
Thread Starter
Hyperactive Member
Hey Guys,
That was good input. It got rid of the error message, but still no file attached (like Merri saw).
Any other ideas? I feel like we're making progress.
--Ben
-
Jun 14th, 2004, 01:39 PM
#8
Hmm... try without Chr$(34) afterall?
-
Jun 14th, 2004, 01:40 PM
#9
Thread Starter
Hyperactive Member
Addendum:
If I use Chr(34) surrounding the filename I get the same error message still. If I use nothing or Chr(39) (single quote) then I recieve no error, the email starts, and no file is attached.
--Ben
-
Jun 14th, 2004, 01:53 PM
#10
More information: "&Attach=" & Chr$(34) & Filename & Chr$(34) works for Outlook, but doesn't work for Outlook Express (according to a site from Google I found). There was no solution to this problem, but I'll continue the search...
Edit Found this code
-
Jun 14th, 2004, 02:19 PM
#11
Thread Starter
Hyperactive Member
Yea,
I had seen that SendKeys code also.. it seems like a hokey way to handle it though.
-
Jun 14th, 2004, 02:23 PM
#12
Yeah, that's what I thought too. And making a build-in e-mail sender isn't probably worth the effort... I didn't find anything from PlanetSourceCode either.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|