Results 1 to 2 of 2
  1. #1
    5 Star Lounger AndrewKKWalker's Avatar
    Join Date
    Apr 2001
    Location
    Cambridge, UK
    Posts
    1,020
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Writing To A Calendar from a User Form? (Outlook 2000/2002)

    Requirement.
    To have a User Form that Prompts for Dept, Start and End dates (I already Have this)
    I have a custom CalendarFolder set up (Let's call it AndrewsCalendar) for now. This will be a shared Calendar.
    I want the form to automatically write the Dept, UserName, Start and End dates into the Calendar with Name and Dept as Subject.

    I can get it to do this in VBA but only to the default calendar.
    How do I get it to write to a specified calendar.
    I am using a UserForm from VBA from a toolbar button.
    Is there a better way?

    Also, I am struggling on getting the UserName in

    Any Help would be good.

    Code on the form at the moment is as below:

    Private Sub cmdSubmit_Click()

    Dim strMsg As String
    Dim oOUT As New Outlook.Application
    Dim oAPP As Outlook.AppointmentItem, oCal As Object



    'Check fields
    If Len(cboDept) = 0 Then
    MsgBox "Department must be selected"
    cboDept.SetFocus
    Exit Sub
    End If

    If Len(txtStart) = 0 Then
    MsgBox "Start Date must be selected"
    txtStart.SetFocus
    Exit Sub
    End If

    If Len(txtEnd) = 0 Then
    MsgBox "End Date must be selected"
    txtEnd.SetFocus
    Exit Sub
    End If

    'All Selected so carry on
    strMsg = "You have Entered a Holiday entry for " & vbLf & "Department : " & cboDept & _
    vbLf & "Starting on " & Format(txtStart, "dd-mmm-yyyy") & vbLf _
    & "Finishing on " & Format(txtEnd, "dd-mmm-yyyy") & vbLf _
    & "All being " & IIf(optHalf = True, " Half Days", " Full Days")

    'Here goes the Calendar update code

    Set oAPP = oOUT.CreateItem(olAppointmentItem)

    'Now add the items to the Calendar

    oAPP.Start = txtStart
    oAPP.End = txtEnd
    oAPP.Subject = "Holiday - " & cboDept
    oAPP.Save


    'Tidy Up
    Set oAPP = Nothing
    Set oOUT = Nothing

    MsgBox strMsg
    Unload Me

    End Sub

    Also Digital Signatures....
    On Outlook 2002 I am getting stitched up by the Security.
    My VBProject is NOT digitally signed and the only signature I have available is NO good.
    Short of running on Minimum security level (Not Good)
    How do I get a valid digital signature for this project?

    Any help gratefully accepted
    Andrew

  2. #2
    Platinum Lounger
    Join Date
    Nov 2001
    Location
    Vienna, Wien, Austria
    Posts
    5,009
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Writing To A Calendar from a User Form? (Outlo

    On the Digital Signature, have you tried using Self-Cert.exe in the Program FilesMicrosoft OfficeOffice folder? HTH
    Gre

Posting Permissions

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