Category Archives for Uncategorized

How to create PowerPoint presentations and add slides to existing presentation with VBA?

A couple days ago, a reader asked about there is a way to programmatically  create PowerPoint presentations from scratch and add slides to an existing presentation.

As we indicated in the past, PowerPoint doesn’t ship a Macro Recorder (Excel and Word has built in recorders for Macro). Therefore, we are left with good old Visual Basic for Application that we can use to create simple Macros to automate PowerPoint. There are further alternatives for Powerpoint Automation, but those goes beyond the scope of this tutorial.

In today’s short tutorial, we’ll go over two use cases:

  1. New presentation creation (blank or usibng a template)
  2. Add slides to an existing presentation.
  3. A mix of the two above mentioned cases (Create from scratch and slides addition)

Let’s get started.

Look at the Ribbon. If you don’t see the a Developer entry in the menu, before start your coding you’ll need to enable the developer tab.

Next, hit on Developer, then hit on the Visual Basic button (or hit Alt+f11) to open the Visual Basic IDE.

VBA to Create PowerPoint Presentation

  1. In the VB Editor, right click on VBAProject and hit Insert.
  2. Select Module
  3. Paste the following code in the newly create module.
Sub CreatePresentation()
Dim NewPres as Presentation
Set NewPres = Presentations.Add
NewPres.SaveAs("MyPresentation.pptx")
End Sub
  1. Hit File and then Save.
  2. To Run your code, hit Run and then pick Run Sub/User Form (or simply F5).
  3. Close the VB editor.

VBA to insert slides

  1. In the VB Editor, right click on VBAProject and hit Insert.
  2. Select Module
  3. Paste the following code in the newly create module.
Sub CreateSlide()
Dim NewSlide as Slide
'This statement ads a title slide
Set NewSlide = ActivePresentation.Slides.Add(Index:=1, Layout:=ppLayoutTitle)
'This statement adds a blank slide in the second place
Set NewSlide = ActivePresentation.Slides.Add(Index:=2, Layout:=ppLayoutBlank)
End Sub
  1. Hit File and then Save.
  2. To Run your code, hit Run and then pick Run Sub/User Form (or simply F5).
  3. Close the VB editor.

Delete Outlook.com / Hotmail account profiles from Microsoft Outlook

Here’s a quick question from Doris:

Hi there. Starting a couple weeks, i use Microsoft Outlook 2019 at work on a daily basis to manage my primary email, calendar and contacts. I have also added additional email addresses to Outlook. specifically my private GMail and Outlook.com mailboxes. Initially that was pretty helpful as i had a one stop shop for all my email – work and personal related. Now i would like to remove my private mailbox from Outlook.  My only concern is that will wipe off my Hotmail account  altogether. Is that the case? How to go about un-linking Hotmail from  Outlook?

Thanks for the question. In my answer i will assume you are in Windows. The procedure for macOS is slightly different.

In the same way that you managed to add Outlook.com mailbox to your Microsoft Outlook you are able to unlink it.

Note that if you remove your Outlook profile any offline or cached information associated with that profile will be removed from your computer. Hence, Before you go ahead and follow this procedure ensure that:

  • You are able to access your Outlook.com/Hotmail mailbox from the web.
  • You have a working backup of your email as a .pst file.

Ok, let’s get started here.

Remove Outlook account from Outlook 2019

Please proceed as following:

  1. Ensure you have your password to Outlook.com / Hotmail.
  2. Navigate to Outlook.com and Login to your mailbox – if you are not able to login, don’t proceed further, as you won’t be able to access your mailbox otherwise.
  3. Open Microsoft Outlook for Windows.
  4. Hit on File.
  5. Now, in the Info tab, hit on Account Settings.
  6. Select Account Settings, the dialog will come up.
  7. In the Email tab, highlight your mailbox.
  8. Hit the Remove button.
  9. Assuming you have created a backup of your email, as explained above, hit OK.

That’s it. You Outlook.com email address profile and mailbox were permanently deleted from your computer. Should you want to re-associate it, kindly proceed according to this tutorial.

Have a great day 😉