+ Reply to Thread
Results 1 to 12 of 12

"save attachment" macro no longer working after upgrate to Office 365

  1. #1
    Forum Contributor
    Join Date
    10-01-2018
    Location
    Virginia Beach, VA
    MS-Off Ver
    365
    Posts
    129

    "save attachment" macro no longer working after upgrate to Office 365

    I have a macro that saves the attachment in a specific folder, which is triggered by a rule set up in outlook to only run on emails from a specific sender.

    Please Login or Register  to view this content.
    This was working fine in Office 2013, but after the upgrade to 365 the rule no longer triggers the macro to run. I have already reactivated the "run macro" action in the rules, and I have re-signed the macro with the required digital signature... The rule runs as it should, but the macro isn't being triggered and/or isn't saving the file.

    The file arrives daily from the specified sender (an automated email from the company accounting program), and always has the same filename... the intent is for it to automatically overwrite the existing file in the referenced network folder.

    I briefly looked into using Flow to accomplish this, but I had no luck in figuring out how that works... best I could find was a template to save ALL attachments to the cloud, which isn't what I want to do at all.

    Anybody know what might have changed in 365 that would disable this macro, and/or have any suggestions on how to accomplish my goal?

  2. #2
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    Office 365 ProPlus
    Posts
    5,855

    Re: "save attachment" macro no longer working after upgrate to Office 365

    How are your calling that sub?

    I.E. how are your defining what your MItem object is?

    EDIT: My guess, is that there is another sub that defines which mail item you want to run your sub on. And that sub is tied to your "run macro" action.
    Last edited by CK76; 09-11-2019 at 03:53 PM.
    ?Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something.?
    ― Robert A. Heinlein

  3. #3
    Forum Contributor
    Join Date
    10-01-2018
    Location
    Virginia Beach, VA
    MS-Off Ver
    365
    Posts
    129

    Re: "save attachment" macro no longer working after upgrate to Office 365

    There's a rule set up that runs the macro, the rule first looks for new email, then specific sender, then attachments. If those three conditions are met, it runs the macro.

  4. #4
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    Office 365 ProPlus
    Posts
    5,855

    Re: "save attachment" macro no longer working after upgrate to Office 365

    Right, but how is that rule supplying to the macro "MItem" object.

    As it's a variable supplied to the sub. Something else must specify and supply the specific MailItem object to the sub.

    Ex:
    Please Login or Register  to view this content.
    Basically, rule uses ProcessAttachment sub, and ProcessAttachment sub calls your SaveAttachmentsToDisk sub with MailItem as argument.

    FYI - Above is just an example. there must be some conditions to check if it's email that should be processed.
    Last edited by CK76; 09-11-2019 at 04:36 PM.

  5. #5
    Forum Contributor
    Join Date
    10-01-2018
    Location
    Virginia Beach, VA
    MS-Off Ver
    365
    Posts
    129

    Re: "save attachment" macro no longer working after upgrate to Office 365

    I don't know, honestly... it was working before I upgraded. That's all I know. I'm not against deleting the rule and the macro, and starting from scratch... the last time I got it set up, it took the better part of a day's worth of googling and I ended up with two different approaches. One of those got deleted while I was trying to get it working again, and I don't remember what the differences were... but they were independent of each other, neither one relied on the other one to work.

  6. #6
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    Office 365 ProPlus
    Posts
    5,855

    Re: "save attachment" macro no longer working after upgrate to Office 365

    Personally, I prefer to use flow to save attachments based on condition to OneDrive.

    Then use synced folder to fetch the updated file.

    I can help with creating Flow. But I'll need details of what conditions to trigger the flow.

    Ex: When new email on Office 365 Mail (Outlook.com), If Folder = Inbox and Subject Contains "Some string". For each attachments Create File in OneDrive.

    0.JPG

  7. #7
    Forum Contributor
    Join Date
    10-01-2018
    Location
    Virginia Beach, VA
    MS-Off Ver
    365
    Posts
    129

    Re: "save attachment" macro no longer working after upgrate to Office 365

    Quote Originally Posted by CK76 View Post
    Then use synced folder to fetch the updated file.

    I can help with creating Flow. But I'll need details of what conditions to trigger the flow.

    Ex: When new email on Office 365 Mail (Outlook.com), If Folder = Inbox and Subject Contains "Some string". For each attachments Create File in OneDrive.
    If possible, I'd rather skip the OneDrive portion and just save the file to the designated network folder... but if OneDrive is the only way to achieve that with Flow, then that works too.

    Basically, I need it to catch any new email (in the Inbox folder) from the sender "[email protected]" that has an attachment. All attachments should be automatically saved to the network address "O:\L-Tec Cut Log\reportsaves". Most importantly, it needs to automatically overwrite the existing file without prompting the user, since the file will always have the same filename, and the email arrives daily at 4:44 a.m., hours before anyone arrives at work. Ideally, the email will also get moved from the Inbox to the folder "Epicor", and marked as "read".

    Any assistance you can provide on setting that up in Flow would be greatly appreciated... I have zero experience working with Flow, so I'll need pretty detailed instructions, LOL...

    Thanks!

  8. #8
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    Office 365 ProPlus
    Posts
    5,855

    Re: "save attachment" macro no longer working after upgrate to Office 365

    Here's how I would do it.

    1. Go to "Create" in Flow and choose start from blank "Automated flow".
    2. Give it some meaningful name, and in the trigger search box, search for "new email". Select "When a new email arrives". Hit "Create".
    3. Expand "Show advanced options"
    4. Set From: to "[email protected]", Has Attachment "Yes", Include Attachments "Yes". And any subject filter you wish to apply. Leave all other field as is.
    5. Add new step and find "Create File OneDrive for Business". It will automatically connect to your OneDrive account. If not log in using same credential as Office 365.
    6. Pick folder to save attachments in.
    7. Click on add dynamic content. And add "Attachments Name" to File Name. And "Attachments Content" to File Content.
    8. Save and run "Flow Checker" at top right. It should show no error or warnings.


    Now, when any new email arrive in Inbox folder of your Office 365 account. This Flow is triggered and will check for who sent it, and that it has attachments and save attachments as is to designated OneDrive folder.

    Next step will depend on your IT structure and it's best to ask your IT person.

    Have a watch of video in link below for how to set up process to automatically move/copy files from one folder to another. Using Task Scheduler.
    Video uses VBS file (script file), but you can use any number of methods (batch file, PowerShell script, python script etc).
    https://www.youtube.com/watch?v=r6n3WRkHQsk

  9. #9
    Forum Contributor
    Join Date
    10-01-2018
    Location
    Virginia Beach, VA
    MS-Off Ver
    365
    Posts
    129

    Re: "save attachment" macro no longer working after upgrate to Office 365

    Thanks, I'll give that a shot and see if it works. I appreciate it!

  10. #10
    Forum Contributor
    Join Date
    10-01-2018
    Location
    Virginia Beach, VA
    MS-Off Ver
    365
    Posts
    129

    Re: "save attachment" macro no longer working after upgrate to Office 365

    I set everything up like you said, and followed the video instructions. The only issue I foresee is that it didn't give me the option to set the network destination file up as "shared", so I don't know if it will work. I tried to test run the task like he did in the video with a dummy file, and it didn't do anything. But I'm going to let it run in the morning, and see if the Flow at least saves the attachment to the onedrive folder... if it does, I'll know where to start tackling the problem. I'll be back on tomorrow with an update.

    Curious though... I did notice that when I got to the "create file" step, I also had an option to "create file - file system"... could I technically use that option to create the file in the network folder directly instead, and bypass the OneDrive and the Task Scheduler entirely?

    Thanks again!

  11. #11
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    Office 365 ProPlus
    Posts
    5,855

    Re: "save attachment" macro no longer working after upgrate to Office 365

    "create file - file system"...
    As long as your IT set something up to allow it.

    For security reasons and/or for governance, most company doesn't allow this type of set up.

  12. #12
    Forum Contributor
    Join Date
    10-01-2018
    Location
    Virginia Beach, VA
    MS-Off Ver
    365
    Posts
    129

    Re: "save attachment" macro no longer working after upgrate to Office 365

    Quote Originally Posted by CK76 View Post
    As long as your IT set something up to allow it.

    For security reasons and/or for governance, most company doesn't allow this type of set up.
    Well, I guess I'm going to have to involve them anyway, because neither the Flow nor the task I set up did anything.

    This should be fun. When I asked IT about using Flow for this right after they upgraded my system to 365, their response was "I'm not sure how Flow works, I'll have to google it." Not exactly inspiring much confidence, lol...

+ 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] Office 2010 Save inserts "Copy of" in filename
    By amthyst826 in forum Excel General
    Replies: 5
    Last Post: 10-10-2014, 03:28 PM
  2. Outlook "Strip Attachment" macro suddenly stopped working
    By Castillb in forum Outlook Programming / VBA / Macros
    Replies: 2
    Last Post: 07-20-2014, 08:31 AM
  3. [SOLVED] "save as .PDF" Macro not working on all Machines
    By Lacaycer in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-03-2012, 01:22 PM
  4. Application.ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",False)" not working
    By redders in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-31-2011, 03:52 PM
  5. Replies: 0
    Last Post: 07-14-2011, 10:15 PM
  6. Difference between "Office.Interop" and "Office.Tools"
    By serhio in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-25-2008, 08:52 AM
  7. [SOLVED] Office 2003 - "autocomplete" in file | open or file | save no longer works
    By Lanwench [MVP - Exchange] in forum Excel General
    Replies: 4
    Last Post: 01-11-2005, 10:06 PM

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