
- VBS SEARCH MULTIPLE EXCEL FILES FOR EMAIL HOW TO
- VBS SEARCH MULTIPLE EXCEL FILES FOR EMAIL CODE
- VBS SEARCH MULTIPLE EXCEL FILES FOR EMAIL DOWNLOAD
Set OFol = Onamespace.GetDefaultFolder(olFolderInbox) Ofol is a must for us otherwise VBA will be angry on you as she does not know where to go. This line will create Onamespace object and later we will use its method “GetDefaultFolder” to work with a folder.īy declaring OFol as folder class, you are telling VBA that there is going to be a folder and that is what we want to target by going into each and every email and pulling out the files from each email. Set ONamespace = OLook.GetNamespace(“MAPI”) Got it ? So, what you say now? I say that knowing classes in VBA is first thing and using them wherever they are needed is the second important thing. Because, to send an email ,I don’t need folders.
VBS SEARCH MULTIPLE EXCEL FILES FOR EMAIL CODE
For eg, If we want to make a code which sends emails then you don’t need this class. This class is used whenever we are dealing with folders in outlook. Namespace class is used to refer to any outlook default Folder – Inbox, Sent, Draft etc. And Once set keyword is used, means your child has arrived in the world and now you are ready to play with him. Remember, Dim is like thinking of a name to your unborn child. Earlier it was only dimensioned by using Dim. For e.g., here we must open emails and see if they have attachments and then save them on desktop accordingly.Ĭreating my email object now using set keyword. “Mail item” is an outlook class which is always going to be used if you are dealing with emails. When you define any object variable then you use “Set” Keyword and if your outlook is not open this code will be responsible to open outlook in backend 😊ĭeclare Outlook application as on object variable. I wonder why there was no 13.0 …may be because Microsoft also considers 13 as unlucky number like I do and many Indians with me. For example, if you are using office 365 or 2016, you will see Microsoft.Outlook.16.0. Remember, Outlook library will be available as per your office version.

For example, Microsoft Outlook library or reference, if you like to select, just press “M” and you will find yourself on Libraries starting with “M”.

VBS SEARCH MULTIPLE EXCEL FILES FOR EMAIL HOW TO
How to Select Outlook Application Library : Open VBA Editor -> Go to Tools -> Reference.Īll External Libraries are sorted alphabetically so you can select it/them easily. For more information, you can check our blog on CLASSES. If you will work with any other application which is not the part of MS Excel Like: – MS Access, MS PowerPoint, MS Word, Web Browser so first we must activate the library or you can say a reference of an object (see below image1) which allows us to use VBA Classes of those applications otherwise Excel VBA will not allow you to access those classes. Hahaha…Cheers to VBA.įirst, we must Activate Outlook Application in VBA Editor. I made this code and now entire work happens in 5 seconds only. 🙂 So, Our Excel VBA comes to rescue to make her life beautiful, far off from tiredness. So, no productivity, no promotion, no goodie -goodie in boss’s eyes. Her problem was that she had to do this manually and it every day was taking 2 hours of her work time.
VBS SEARCH MULTIPLE EXCEL FILES FOR EMAIL DOWNLOAD
Is all fine with her? She replied, client sends her 96 emails and all those.Įmails have attachments which she must download one by one on desktop and then run a macro which compiles the data, but that later.

I joined a new office few years back and found a lady quite irritated and almost in the condition of giving up the day-to-day routine job. How to Save Attachments from Outlook (if you have multiple emails in outlook and you want to save all the attachments and you are doing manually then this code will help you and save your time.)
