Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 537291
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T09:54:42+00:00 2026-05-13T09:54:42+00:00

I’m basically trying to figure out how to create a macro in Outlook that

  • 0

I’m basically trying to figure out how to create a macro in Outlook that allows me to create an appointment with a specific category, that then copies the appointment from the user’s local calendar to an Exchange shared calendar (provided it has the right category).

Does anyone have a bit more insight into the Outlook object model on how this would function?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T09:54:42+00:00Added an answer on May 13, 2026 at 9:54 am

    Here is some sample code that may help:

    Sub CreateCalEntry(LeadDate As Date, DueDate As Date, _
            Subject As String, Location As String, Body As String, _
            Optional AddToShared As Boolean = True)
    Const olApItem = 1
    
    ''This example uses late binding, hence object, rather than the commented
    ''declarations
    Dim apOL As Object ''Outlook.Application
    Dim oItem As Object ''Outlook.AppointmentItem '
    Dim objFolder As Object ''MAPI Folder
    
    
        Set apOL = CreateObject("Outlook.Application")
        ''This is the folder to copy to:
        Set objFolder = GetFolder("Public Folders/All Public Folders/Shared Calender")
        Set oItem = apOL.CreateItem(olApItem) ''See const, above
    
        With oItem
            .Subject = Subject
            .Location = Location
            .Body = Body
            .Start = DueDate
    
            If AddToShared = True Then
                .Move objFolder
            End If
    
            .Display
        End With
    
        Set oItem = Nothing
        Set apOL = Nothing
    End Sub
    

    This allows you to find the shared folder:

    Public Function GetFolder(strFolderPath As String) As Object 'MAPIFolder
    '' strFolderPath needs to be something like
    ''   "Public Folders\All Public Folders\Company\Sales" or
    ''   "Personal Folders\Inbox\My Folder"
    
    Dim apOL As Object ''Outlook.Application
    Dim objNS As Object ''Outlook.NameSpace
    Dim colFolders As Object ''Outlook.Folders
    Dim objFolder As Object ''Outlook.MAPIFolder
    Dim arrFolders() As String
    Dim i As Long
    
    On Error GoTo TrapError
    
        strFolderPath = Replace(strFolderPath, "/", "\")
        arrFolders() = Split(strFolderPath, "\")
    
        Set apOL = CreateObject("Outlook.Application")
        Set objNS = apOL.GetNamespace("MAPI")
    
    
        On Error Resume Next
    
        Set objFolder = objNS.Folders.Item(arrFolders(0))
    
        If Not objFolder Is Nothing Then
            For i = 1 To UBound(arrFolders)
                Set colFolders = objFolder.Folders
                Set objFolder = Nothing
                Set objFolder = colFolders.Item(arrFolders(i))
    
                If objFolder Is Nothing Then
                    Exit For
                End If
            Next
        End If
    
    On Error GoTo TrapError
    
        Set GetFolder = objFolder
        Set colFolders = Nothing
        Set objNS = Nothing
        Set apOL = Nothing
    
    Exit_Proc:
        Exit Function
    
    TrapError:
        MsgBox Err.Number & ": " & Err.Description
    
    End Function
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.