Re: Attachment code won't work

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Sue Mosher [MVP-Outlook] (suemvp_at_outlookcode.com)
Date: 01/31/05


Date: Mon, 31 Jan 2005 11:50:47 -0500

Is it possible that your With statement is in the wrong place or has some
other problem? You didn't show it. Also, what happens if you explicitly set
a string variable to the path:

    strPath = [fsfrSupportersMessage].[Form]![fAttachment]
    If not strPath = "" Then
        Set objOutlookAttach = .Attachments.Add(strPath)
    End If

-- 
Sue Mosher, Outlook MVP
Author of
     Microsoft Outlook Programming - Jumpstart for
     Administrators, Power Users, and Developers
     http://www.outlookcode.com/jumpstart.aspx
"Ray" <mym4junk@hotmail.com> wrote in message 
news:%232sZ3E7BFHA.3180@TK2MSFTNGP10.phx.gbl...
> Hi
>
> I posted this in a access group and then later read a response to another 
> question that made me realise I should have posted here. Sorry about the 
> double post.
>
> I have been trying to modify some code I picked up from
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dno2k3ta/html/odc_ac_olauto.asp
>
> I am uing Office 2003
>
> I have modified most of it to run referencing my form but the attachment
> section doesn't work properly. I hope someone can help me
>
> The original code section is as follows
>
>      ' Add attachments to the message.
>      If Not IsMissing(AttachmentPath) Then
>         Set objOutlookAttach = .Attachments.Add(AttachmentPath)
>      End If
>
> When I first tested the code as the web article suggested it worked fine 
> but
> now that I have modified it to read from my form it doesn't work
>
>      ' Add attachments to the message.
>      If Not IsNull([fsfrSupportersMessage].[Form]![fAttachment]) Then
>         Set objOutlookAttach = 
> .Attachments.Add([fsfrSupportersMessage].[Form]![fAttachment])
>      End If
>
> No matter what I try objOutlookAttach always show as being
> "objOutlookAttach = Nothing" Yet when I point at
> ([fsfrSupportersMessage].[Form]![fAttachment]) the correct path is 
> reported.
>
> The error message reads "438 Object doesn't support this property or 
> method"
>
> Please I am confused and can't seem to see my way forward on this one. Any
> help would be very much appreciated.
>
> Ray
>
> 


Relevant Pages

  • RE: Attachment code wont work
    ... "Ray" wrote: ... ' Add attachments to the message. ... > No matter what I try objOutlookAttach always show as being ... > The error message reads "438 Object doesn't support this property or method" ...
    (microsoft.public.outlook.program_vba)
  • Re: Attachment code wont work
    ... Your suggestion worked after I added Dim strPath As String ... Ray ... >> ' Add attachments to the message. ...
    (microsoft.public.outlook.program_vba)
  • Re: saving an attachment to a particular folder when mail recd with a particular subject
    ... > to loop through the attachments. ... I know for certain that the folder named ... >> Sue Mosher, Outlook MVP ...
    (microsoft.public.outlook.program_vba)
  • Re: Macto to strip attachments from email
    ... These samples show a couple of different ways to save attachments: ... > One of the repetitive tasks I have to do at work is to ... > review my emails, delete attachments that I no longer ...
    (microsoft.public.outlook.program_vba)
  • Re: from the latest vulnerability...
    ... Ray asks: ... First we simply told people to not open attachments ... >discovered NIMDA could infect a computer simply by visiting the page of an ...
    (microsoft.public.security)