+ Reply to Thread
Results 1 to 8 of 8

Outlook Attachment VBA issue

  1. #1
    Registered User
    Join Date
    06-02-2014
    Posts
    23

    Outlook Attachment VBA issue

    So I have a macro that is supposed to insert text from the body of an incoming e-mail into an Excel doc on my computer (this part is working fine) and then download the attachments to a certain folder (not working). Eventually the macro will also run another macro that is on the Excel doc to upload the data from the attachments, but first I need to get these attachments to download. The weird thing is it will work one or two times and then just not work anymore. When it doesn't work, I get the "Rules in Error" dialogue that says the error is "The operation failed." My macro settings are wide open so I have no idea what could be going wrong. Did I define something wrong?

    Here is my code thus far.

    Please Login or Register  to view this content.
    Thanks for any help!

  2. #2
    Forum Contributor pareshj's Avatar
    Join Date
    05-20-2014
    Location
    MUMBAI
    MS-Off Ver
    2007 & 2010
    Posts
    447

    Re: Outlook Attachment VBA issue

    Hi bullo1854,

    Use the below code and check if it helps. I have use .FileName instead of .DisplayName.

    objAtt.SaveAsFile saveFolder & objAtt.FileName

    Also, You need to check couple of things here:
    1) If you are saying it is working fine one or two times then you need to check on Network path.
    2) Check whether network is steady.



    Regards,
    Paresh J
    Click on "* Add Reputation" as a way to say thanks

  3. #3
    Registered User
    Join Date
    06-02-2014
    Posts
    23

    Re: Outlook Attachment VBA issue

    Paresh,

    I tried using just file name and that did not work. I also changed saveFolder to a local folder on my C: drive and still had the same issue. The times that it seems to work are after I do several modifications (which always gets my hopes up) or sometimes after I restart Outlook.

    Thanks for the help,

    John

  4. #4
    Forum Contributor pareshj's Avatar
    Join Date
    05-20-2014
    Location
    MUMBAI
    MS-Off Ver
    2007 & 2010
    Posts
    447

    Re: Outlook Attachment VBA issue

    Hi,

    Do one thing now, dont try to save the file in the folder. Just check what output does the below code gives for each attachment.

    objAtt.FileName

    I think it must be something in the file names that is obstructing it from saving it into local folder.
    Check each attachment name by debugging.


    Regards,
    Paresh J

  5. #5
    Registered User
    Join Date
    06-02-2014
    Posts
    23

    Re: Outlook Attachment VBA issue

    Paresh,

    Did you mean just change the For Each to

    Please Login or Register  to view this content.
    I did that and still got the error

  6. #6
    Forum Contributor pareshj's Avatar
    Join Date
    05-20-2014
    Location
    MUMBAI
    MS-Off Ver
    2007 & 2010
    Posts
    447

    Re: Outlook Attachment VBA issue

    Hi,

    I am saying check the file names.

    Regards,
    Paresh J

  7. #7
    Registered User
    Join Date
    06-02-2014
    Posts
    23

    Re: Outlook Attachment VBA issue

    How do you mean?

  8. #8
    Forum Contributor pareshj's Avatar
    Join Date
    05-20-2014
    Location
    MUMBAI
    MS-Off Ver
    2007 & 2010
    Posts
    447

    Re: Outlook Attachment VBA issue

    Hi,

    I mean debug objAtt.FileName and check each value of attachments.

    Regards,
    Paresh J

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] VBA Macro to print to Pdf format and place as attachment in Outlook (Excel & Outlook 2007)
    By Webman1012 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-29-2013, 01:25 PM
  2. Open Outlook Attachment into Excel
    By majosum in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-12-2013, 07:38 PM
  3. excel vba to get the emails with attachment in outlook
    By Megatronixs in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-12-2012, 03:37 PM
  4. [SOLVED] Issue - Attachment issue - by Simon Lloyd
    By Vaibhav in forum Suggestions for Improvement
    Replies: 16
    Last Post: 03-16-2012, 06:56 PM
  5. Create Outlook attachment
    By rlsublime in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-03-2012, 04:23 AM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1