Many users of Spindle Professional choose to generate emails from Spindle to the drafts folder for various reason. The steps below will help you to create a visual basic command within Outlook to send all the emails from the drafts folder that have a recipient email address.
Enable Developer Options
First, click on File in the top left hand corner. Next click on options in the left hand pane.
Thereafter, click on Customise Ribbon and check the box next to Developer. Click OK.
Now you should see a new tab at the top of our Outlook window named Developer. Click on Visual Basic to bring up the console window for Outlook.
Double click on ThisOutlookSession in the left hand pane. This should bring up an empty visual basic console window. Enter the code below in the console window.
Replace InsertFolderNameHere with the name of the mailbox that the draft folder resides in. In this case, it is my email address.
Public Sub SendDrafts() Dim lDraftItem As Long Dim myOutlook As Outlook.Application Dim myNameSpace As Outlook.NameSpace Dim myFolders As Outlook.Folders Dim myDraftsFolder As Outlook.MAPIFolder 'Send all items in the "Drafts" folder that have a "To" address filled in. 'Setup Outlook Set myOutlook = Outlook.Application Set myNameSpace = myOutlook.GetNamespace("MAPI") Set myFolders = myNameSpace.Folders 'Set Draft Folder. This will need modification based on where it's being run. Set myDraftsFolder = myFolders("InsertFolderNameHere").Folders("Drafts") 'Loop through all Draft Items For lDraftItem = myDraftsFolder.Items.Count To 1 Step -1 'Check for "To" address and only send if "To" is filled in. If Len(Trim(myDraftsFolder.Items.Item(lDraftItem).To)) > 0 Then 'Send Item myDraftsFolder.Items.Item(lDraftItem).Send End If Next lDraftItem 'Clean-up Set myDraftsFolder = Nothing Set myNameSpace = Nothing Set myOutlook = Nothing End Sub
The console window should now look like the screenshot below. Click Save to save the code and exit the visual basic window.
You should now have a macro command in the developer tab under Macros.
Adding macro to your most commonly used pane
To add the macro command to your most commonly used pane, click on File and then Options. Click on Customise Ribbon and from the drop down menu, click on Macros. My most commonly used pane is Home. To add a Macro command to the Home pane, first you have to create a new group. I renamed my new group to Macros. Thereafter, click on the macro command and click Add.
You should now see the macro in your most commonly used pane.
|Related Product||Spindle Professional|
|Original Author||Zak Rangara|
|Update Author||Vince Hodgson|