Results 1 to 7 of 7
  1. #1
    Super Moderator WebGenii's Avatar
    Join Date
    Jan 2001
    Location
    Redcliff, Alberta, Canada
    Posts
    4,066
    Thanks
    2
    Thanked 5 Times in 5 Posts

    Calendar Entry in Custom Folder (Outlook 2003)

    I am creating a calendar entry. But much to my frustration I can not seem to get it to save to the custom folder I have created.

    Does anyone have any pointers or suggestions?
    [b]Catharine Richardson (WebGenii)
    WebGenii Home Page
    Moderator: Spreadsheets, Other MS Apps, Presentation Apps, Visual Basic for Apps, Windows Mobile

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Calendar Entry in Custom Folder (Outlook 2003)

    When you created the folder, Outlook asked you what kind of items you wanted to store there. Did you specify appointment items?

  3. #3
    Super Moderator WebGenii's Avatar
    Join Date
    Jan 2001
    Location
    Redcliff, Alberta, Canada
    Posts
    4,066
    Thanks
    2
    Thanked 5 Times in 5 Posts

    Re: Calendar Entry in Custom Folder (Outlook 2003)

    Calendar Items
    and I can create items manually and save to that folder.
    [b]Catharine Richardson (WebGenii)
    WebGenii Home Page
    Moderator: Spreadsheets, Other MS Apps, Presentation Apps, Visual Basic for Apps, Windows Mobile

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Calendar Entry in Custom Folder (Outlook 2003)

    Can you provide more information about the code you are using?

  5. #5
    Super Moderator WebGenii's Avatar
    Join Date
    Jan 2001
    Location
    Redcliff, Alberta, Canada
    Posts
    4,066
    Thanks
    2
    Thanked 5 Times in 5 Posts

    Re: Calendar Entry in Custom Folder (Outlook 2003)

    <pre>Sub NewWBECalendarEntry()
    Dim objNS As Outlook.NameSpace
    Dim collFolders As Outlook.Folders
    Dim objFolder As MAPIFolder
    Dim myOlApp As Outlook.Application
    Dim myItem As Outlook.AppointmentItem
    Dim stCurDateTime As String
    Dim dtCurDateTime As Date
    Dim stCurCategories As String

    Set objNS = Application.GetNamespace("MAPI")
    Set collFolders = objNS.Folders
    Set objFolder = collFolders(2).Folders("Thomas")
    ActiveExplorer.SelectFolder objFolder '
    stCurDateTime = Date & " " & Time
    dtCurDateTime = CDate(stCurDateTime)

    ' set
    Set myOlApp = CreateObject("Outlook.Application")
    Set myItem = myOlApp.CreateItem(olAppointmentItem)

    stCurCategories = "WBE"
    With myItem
    .Subject = "Test Entry"
    .Start = dtCurDateTime
    End With
    myItem.Categories = stCurCategories
    myItem.Display
    myItem.Close olSave

    MsgBox objFolder.GetExplorer
    MsgBox myItem.Parent
    MsgBox myItem.Session
    MsgBox myItem.GetInspector

    End Sub
    </pre>

    [b]Catharine Richardson (WebGenii)
    WebGenii Home Page
    Moderator: Spreadsheets, Other MS Apps, Presentation Apps, Visual Basic for Apps, Windows Mobile

  6. #6
    Super Moderator WebGenii's Avatar
    Join Date
    Jan 2001
    Location
    Redcliff, Alberta, Canada
    Posts
    4,066
    Thanks
    2
    Thanked 5 Times in 5 Posts

    Re: Calendar Entry in Custom Folder (Outlook 2003)

    This is the best option (meaning only one I've found that works) - but it seems a little clunky.
    after creating the calendar item with the options
    <pre> myItem.Display
    myItem.Save
    myItem.Move objFolder
    myItem.Close olSave
    </pre>

    [b]Catharine Richardson (WebGenii)
    WebGenii Home Page
    Moderator: Spreadsheets, Other MS Apps, Presentation Apps, Visual Basic for Apps, Windows Mobile

  7. #7
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Calendar Entry in Custom Folder (Outlook 2003)

    To create an item in a specific folder, don't use CreateItem, but:

    Set myItem = objFolder.Items.Add

    Your code could cause problems because you're using two Application objects: you have

    Set objNS = Application.GetNamespace("MAPI")

    before you create an Outlook.Application object. If you are running this code from within Outlook itself, there is no need to create such an object - it is already available, so you can use Application instead of myOlApp. If you're running this code from outside Outlook, the above line should cause an error. You should create myOlApp first, then use

    Set objNS = myOlApp.GetNamespace("MAPI")

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •