Ir para o conteúdo principal

Como importar aniversários do Excel para o calendário do Outlook?

Se você tiver uma longa lista de informações de aniversário em uma planilha, agora, você deseja importar esses aniversários para o calendário do Outlook como eventos. Como você poderia lidar com essa tarefa com alguns métodos rápidos?


Importar aniversários do Excel para o calendário do Outlook com código VBA

Normalmente, não existe uma maneira direta de importar os aniversários para o calendário do Outlook, aqui, vou criar um código VBA para resolver esse problema, por favor, siga os seguintes passos:

1. Abra a planilha que contém os aniversários que você deseja importar para o Outlook e, em seguida, mantenha pressionado o botão ALT + F11 chaves para abrir o Microsoft Visual Basic para Aplicações janela.

2. Clique inserção > Móduloe cole o código a seguir na janela do módulo.

Código VBA: Importar aniversários para o calendário do Outlook

Sub ImportBirthdaysToCalendar()
'Updateby ExtendOffice
Dim xWs As Excel.Worksheet
Dim xRng As Range
Dim xOlApp As Outlook.Application
Dim xCalendarFld As Outlook.Folder
Dim xAppointmentItem As Outlook.AppointmentItem
Dim xRecurrencePattern As Outlook.RecurrencePattern
Dim xRow As Integer
On Error Resume Next
Set xWs = ThisWorkbook.ActiveSheet
Set xRng = Application.InputBox("Please select the data range (only two columns):", "Kutools for Excel", , , , , , 8)
If xRng Is Nothing Then Exit Sub
If xRng.Columns.Count <> 2 Then
  MsgBox "You can only select two columns", vbOKOnly + vbCritical, "Kutools for Excel"
  Exit Sub
End If
Set xOlApp = CreateObject("Outlook.Application")
Set xCalendarFld = xOlApp.Session.GetDefaultFolder(olFolderCalendar)
For xRow = 1 To xRng.Rows.Count
  Set xAppointmentItem = xCalendarFld.Items.Add("IPM.Appointment")
  With xAppointmentItem
    .Subject = xRng.Cells(xRow, 1) & Chr(39) & "s Birthday"
    .AllDayEvent = True
    .Start = xRng.Cells(xRow, 2)
    Set xRecurrencePattern = .GetRecurrencePattern
    xRecurrencePattern.RecurrenceType = olRecursYearly
    .Save
  End With
Next
Set xWs = Nothing
Set xCalendarFld = Nothing
Set xOlApp = Nothing
End Sub

3. Ainda no Microsoft Visual Basic para Aplicações janela, clique em Ferramentas > Referências. No saiu Referências - VBAProject caixa de diálogo, verifique Biblioteca de objetos do Microsoft Outlook 16.0 opção do formulário Referências Disponíveis caixa de lista, veja a captura de tela:

4. Então clique OK para fechar esta caixa de diálogo. Agora, pressione F5 key para executar este código e uma caixa de prompt é exibida, selecione as colunas de nome e aniversário, veja a captura de tela:

5. E então, clique OK botão, os aniversários serão importados para o calendário do Outlook de uma só vez, você pode iniciar o Outlook para ver o resultado, veja a captura de tela:


Melhores ferramentas de produtividade de escritório

Kutools for Outlook - Mais de 100 recursos poderosos para turbinar seu Outlook

🤖 Assistente de correio AI: E-mails profissionais instantâneos com magia de IA – um clique para respostas geniais, tom perfeito, domínio multilíngue. Transforme o envio de e-mails sem esforço! ...

📧 Automação de e-mail: Fora do escritório (disponível para POP e IMAP)  /  Agendar envio de e-mails  /  CC/BCC automático por regras ao enviar e-mail  /  Encaminhamento automático (regras avançadas)   /  Adicionar saudação automaticamente   /  Divida automaticamente e-mails de vários destinatários em mensagens individuais ...

📨 Gestão de E-mail: Lembre-se facilmente de e-mails  /  Bloquear e-mails fraudulentos por assuntos e outros  /  Apagar Emails Duplicados  /  Pesquisa Avançada  /  Consolidar pastas ...

📁 Anexos PróSalvar em lote  /  Desanexar lote  /  Comprimir em Lote  /  Salvamento automático   /  Desanexação Automática  /  Compressão automática ...

???? Interface Mágica: 😊Mais emojis bonitos e legais   /  Aumente a produtividade do seu Outlook com visualizações com guias  /  Minimize o Outlook em vez de fechar ...

???? Maravilhas com um clique: Responder a todos com anexos recebidos  /   E-mails antiphishing  /  🕘Mostrar fuso horário do remetente ...

👩🏼‍🤝‍👩🏻 Contatos e calendário: Adicionar contatos em lote de e-mails selecionados  /  Dividir um grupo de contatos em grupos individuais  /  Remover lembretes de aniversário ...

Sobre Características 100 Aguarde sua exploração! Clique aqui para descobrir mais.

 

 

Comments (5)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Hi Skyyang,

I'm trying to use the code to import the birthdays into a Sharepoint Events List, which is located in my outlook as calendar, but when i run and then select the calendar the recurrances briefly show up and then vanish again right away.
I did successfully import the recurrances into my personal Calendar but I need it to go to the sharepoint calendar to share it with the company :( any ideas?

kind regards
Jonas
This comment was minimized by the moderator on the site
This is very helpful, thank you! Do you have a specific VBA code for the import, but specifically goes to the "Birthday" calendar in Outlook?

Also, now that I've imported to my calendar, is there an easy way to remove all of those inputted, if needed?

Thank you!
This comment was minimized by the moderator on the site
Hello, Sam,
May be the below VBA code can do you a favor:

Sub ImportBirthdaysToCalendar()
'Updateby ExtendOffice
Dim xWs As Excel.Worksheet
Dim xRng As Range
Dim xOlApp As Outlook.Application
Dim xCalendarFld As Outlook.Folder
Dim xAppointmentItem As Outlook.AppointmentItem
Dim xRecurrencePattern As Outlook.RecurrencePattern
Dim xRow As Integer
On Error Resume Next
Set xWs = ThisWorkbook.ActiveSheet
Set xRng = Application.InputBox("Please select the data range (only two columns):", "Kutools for Excel", , , , , , 8)
If xRng Is Nothing Then Exit Sub
If xRng.Columns.Count <> 2 Then
  MsgBox "You can only select two columns", vbOKOnly + vbCritical, "Kutools for Excel"
  Exit Sub
End If
Set xOlApp = CreateObject("Outlook.Application")
'Set xCalendarFld = xOlApp.Session.GetDefaultFolder(olFolderCalendar)
Set xCalendarFld = xOlApp.Session.PickFolder
If xCalendarFld.DefaultItemType <> olAppointmentItem Then
  MsgBox "Please Select calendar folder. ", vbOKOnly + vbInformation, "Kutools for Outlook"
  Exit Sub
End If
For xRow = 1 To xRng.Rows.Count
  Set xAppointmentItem = xCalendarFld.Items.Add("IPM.Appointment")
  With xAppointmentItem
    .Subject = xRng.Cells(xRow, 1) & Chr(39) & "s Birthday"
    .AllDayEvent = True
    .Start = xRng.Cells(xRow, 2)
    Set xRecurrencePattern = .GetRecurrencePattern
    xRecurrencePattern.RecurrenceType = olRecursYearly
    .Save
  End With
Next
Set xWs = Nothing
Set xCalendarFld = Nothing
Set xOlApp = Nothing
End Sub


After running this code, you can create a new folder in the calendar, and the imported birthday will be saved in this new folder, if you need to remove the birthdays, you just need go to this folder, and delete them at once.
https://www.extendoffice.com/images/stories/comments/comment-skyyang/2023-comment/doc-import-birthday.png
This comment was minimized by the moderator on the site
Hi Skyyang,

I'm trying to use the code to import the birthdays into a Sharepoint Events List, which is located in my outlook as calendar, but when i run and then select the calendar the recurrances briefly show up and then vanish again right away.
I did successfully import the recurrances into my personal Calendar but I need it to go to the sharepoint calendar to share it with the company :( any ideas?

kind regards
Jonas
This comment was minimized by the moderator on the site
Hi Skyyang,

I'm trying to use the code to import the birthdays into a Sharepoint Events List, which is located in my outlook as calendar, but when i run and then select the calendar the recurrances briefly show up and then vanish again right away.
I did successfully import the recurrances into my personal Calendar but I need it to go to the sharepoint calendar to share it with the company :( any ideas?

kind regards
Jonas
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations