1

I am trying to edit an existing macro that sends out each row of a spreadsheet as an email. I want the macro to send out these emails in batches instead of all at once. I am using .DeferredDeliveryTime to do this. The macro that I have has this at the end

Set olMail = Nothing
Set olApp = Nothing 

My question is if I remove this part will my deferred emails still be sent. I am afraid these lines will close outlook and the emails won't be sent.

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
navneesi
  • 21
  • 1
  • 6
  • My VBA code looks something like this - http://www.rondebruin.nl/win/s1/outlook/bmail4.htm – navneesi Oct 24 '18 at 01:43
  • 3
    Those are [completely unnecessary](https://blogs.msdn.microsoft.com/ericlippert/2004/04/28/when-are-you-required-to-set-objects-to-nothing/). – Comintern Oct 24 '18 at 01:44

1 Answers1

1

Setting to Nothing isn't necessary(in modern Excel versions 2010+). but there were issues with older versions of Excel (for which the workaround was to explicitly set).

It's just release an object and clear memory in VBA. For more information, you can refer the following link:

When should an Excel VBA variable be killed or set to Nothing?

Simon Li
  • 303
  • 2
  • 4