Attaching files with CDO

Results 1 to 2 of 2

Thread: Attaching files with CDO

  1. #1
    Hank Anderson Guest

    Default Attaching files with CDO

    I am using the following code to try to send out a message with an attached file using CDO:<BR><BR>&#060;%<BR>Dim objMail<BR>Set objMail = Server.CreateObject("CDONTS.NewMail")<BR>&#037;&#0 62;<BR><BR>&#060;%<BR>Set objMail = CreateObject("CDONTS.Newmail")<BR>objMail.From = ""<BR>objMail.To = ""<BR>objMail.Subject = "Test"<BR>objMail.Body = "This is a test"<BR>objMail.AttachFile ("c:inetpubwwwrootmsccpics.htm", "Pictures")<BR>objMail.Send<BR>Set objMail = Nothing<BR>&#037;&#062;<BR><BR>With the AttachFile line commented out it works fine, but when I add the AttachFile line I get the following error:<BR><BR>Microsoft VBScript compilation error &#039 800a0414&#039 <BR><BR>Cannot use parens when calling a Sub <BR><BR>/testmail2.asp, line 15 <BR><BR>objMail.AttachFile ("c:inetpubwwwrootmsccpics.htm", "Pictures")<BR>-------------------------------------------------------------------^<BR><BR>Any suggestions as to how to avoid this error would be appreciated.<BR>

  2. #2
    Ben Timb Guest

    Default RE: Attaching files with CDO

    Do This:<BR>objMail.AttachFile "c:inetpubwwwrootmsccpics.htm", "Pictures"<BR> I dunno why, but when you get that error, just don&#039t use parenthesis when calling the function/sub/method on the referenced line number, I found that when you use more than one parameter with a user defined sub this is always the case.

Posting Permissions

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