Solved

Post form fields onto calendar

Posted on 2002-07-26
2
141 Views
Last Modified: 2013-12-26
I have an outlook form that I am designing.  It is a function catering form.  What I want to do is that whenever someone completes the form, I want that form to post the date,time, subject and userid into an public calendar folder (named catering).

Can anybody help me or steer me into the right direction?
0
Comment
Question by:vhooper780
2 Comments
 
LVL 12

Accepted Solution

by:
jgv earned 200 total points
ID: 7183065
Here's a quick example of how to find the "catering" folder and adding a new appointment item. Make sure you add a reference to "Microsoft Outlook"

Private Sub cmdAddAppointment_Click()

   Dim olApp As New Outlook.Application
   Dim olSession As Outlook.NameSpace
   Dim olCaterFolder As Outlook.MAPIFolder
   Dim olApptItem As Outlook.AppointmentItem
   
   ' Get a reference to the session.
   Set olSession = olApp.GetNamespace("MAPI")

    ' Find the catering folder starting at the root
    Set olCaterFolder = ProcessFolder(olSession.Folders(1))
    If olCaterFolder Is Nothing Then
        MsgBox "folder not found"
        Exit Sub
    End If
   
    ' Add the new appointment item to the catering folder
    Set olApptItem = olCaterFolder.Items.Add
    olApptItem.Subject = "The subject"
    olApptItem.Start = Now()
    olApptItem.Save
   
End Sub

Private Function FindFolder(CurrentFolder As Outlook.MAPIFolder) As MAPIFolder
    Dim olNewFolder As Outlook.MAPIFolder
   
   ' Loop through and search each subfolder of the current folder.
   For Each olNewFolder In CurrentFolder.Folders
       
        ' If we have a match, return the folder object and exit
        If olNewFolder.Name = "catering" And olNewFolder.DefaultItemType = olAppointmentItem Then
            Set FindFolder = olNewFolder
            Exit Function
        End If
       
        ' Recurse any subfolders in the current folder.
        Set FindFolder = FindFolder(olNewFolder, sName, sType)
        ' If a folder object was returned the target was found; exit...
        If Not FindFolder Is Nothing Then Exit Function
       
   Next
   
End Function

-----------------------------------------------------

A good resource for Outlook related info is
www.slipstick.com
There is section on custom forms which shows how to retrieve form fields that you can incorporate into the above example.
0
 

Author Comment

by:vhooper780
ID: 7185164
Thanks, I believe I can work with this.
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now