Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Add attachment to email in VB code
How can I add an attachment to this email using my code below. txtAttach.Tex
t
is populated with a file path.  However it doesn't seem to be working.
I get an error that reads:  'Object doesn't support named arguments'  Is
something wrong in the syntax or code?
Thanks,
Sean

********

' email
Dim App
Dim Item
Dim y As Integer

Dim sInFolder() As String
Attachment = txtAttach.Text
Set App = CreateObject("Outlook.Application")
Set Item = App.CreateItem(0)

With Item
.Subject =
.To =
.Cc =
.Body =

If chkAttach.Value = 1 And Len(Attachment > 20) Then
.Attachments.Add Source:=Attachment
End If

.Send

End With
Set App = Nothing
Set Item = Nothing

Report this thread to moderator Post Follow-up to this message
Old Post
Sean
10-27-04 08:55 PM


Re: Add attachment to email in VB code
Without trying it remove the named argument and replace with something like
this:

.Attachments.Add Attachment

--
Chris Hanscom - Microsoft MVP (VB)
http://www.veign.com
--

"Sean" <Sean@discussions.microsoft.com> wrote in message
news:E9AD4503-F3E2-49E0-9C86-C7217016CA36@microsoft.com...
> How can I add an attachment to this email using my code below.
txtAttach.Text
> is populated with a file path.  However it doesn't seem to be working.
> I get an error that reads:  'Object doesn't support named arguments'  Is
> something wrong in the syntax or code?
> Thanks,
> Sean
>
> ********
>
> ' email
> Dim App
> Dim Item
> Dim y As Integer
>
> Dim sInFolder() As String
> Attachment = txtAttach.Text
> Set App = CreateObject("Outlook.Application")
> Set Item = App.CreateItem(0)
>
>     With Item
>         .Subject =
>         .To =
>         .Cc =
>         .Body =
>
>         If chkAttach.Value = 1 And Len(Attachment > 20) Then
>         .Attachments.Add Source:=Attachment
>         End If
>
>         .Send
>
>     End With
> Set App = Nothing
> Set Item = Nothing



Report this thread to moderator Post Follow-up to this message
Old Post
Veign
10-28-04 01:55 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Visual Basic archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 04:52 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.