-5

I need to open an Excel attachment in Outlook that comes in every hour with fresh data. I then need to copy and replace this fresh data in another Excel application, refresh the PivotTable and send to a bunch of people via Outlook.

Please help me with VBA code that will automate this process.

pnuts
  • 54,806
  • 9
  • 74
  • 122
  • 1
    You have add what you have tried so far. See the [How to create a Minimal, Complete, and Verifiable example](http://stackoverflow.com/help/mcve) for help clarifying this question. – Ram Feb 11 '15 at 19:27
  • 1
    You should start with reading through this example of how to download an attachment from outlook and Open in Excel http://stackoverflow.com/questions/11781320/download-attachment-from-outlook-and-open-in-excel then see how far you get and then we can help you from there – jamesC Feb 11 '15 at 19:37

1 Answers1

0

The Outlook object model doesn't provide anything for opening excel files on the fly. You need to save the attached file on the disk and then open it. The SaveAs method of the Attachment class saves the attachment to the specified path.

Most probably you need to be aware when the new item arrives in Outlook. The Application class provides the NewMailEx event which is fired when a new item is received in the Inbox.

Finally, I'd suggest starting from the Getting Started with VBA in Outlook 2010 article in MSDN.

Eugene Astafiev
  • 26,795
  • 2
  • 13
  • 31