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

  • SEARCH
  • Home
  • 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 8898465
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T00:37:23+00:00 2026-06-15T00:37:23+00:00

I am attempting to generate an appointment from a VBA macro and put it

  • 0

I am attempting to generate an appointment from a VBA macro and put it into a calendar in Outlook. my code is below…

Sub CommandButton1_Click()

Const olAppointmentItem As Long = 1
    Dim olapp As Object
    Dim OLNS As Object
    Dim OLAppointment As Object


    On Error Resume Next
    Set olapp = GetObject(, "Outlook.Application")
    If olapp Is Nothing Then Set olapp = CreateObject("Outlook.Application")
    On Error GoTo 0

    If Not olapp Is Nothing Then

        Set OLNS = olapp.GetNamespace("MAPI")
        OLNS.Logon

        Set OLAppointment = olapp.CreateItem(olAppointmentItem)
        OLAppointment.Subject = "Request for Leave"
        OLAppointment.Start = TimeValue(TextBox7.Text)
        OLAppointment.End = TimeValue(TextBox10.Text)

        OLAppointment.Location = "Leave"
        OLAppointment.Body = "Request for Leave"
        OLAppointment.Save

         'Set OLAppointment = olapp.Move(olfolder)

        Set OLAppointment = Nothing
        Set OLNS = Nothing
        Set olapp = Nothing
    End If

End Sub

The problem is that the appointment gets dated to begin on the ‘Sat 30/12/1899’ and only lasts for half an hour when i need it to last for the duration of days between the two dates as an all day appointment throughout, (Start date : TextBox7)(End date : TextBox10).

Another issue is how would i send this request to someone?

The appointment details are from an Excel UserForm’s text fields

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-06-15T00:37:24+00:00Added an answer on June 15, 2026 at 12:37 am

    TimeValue doesn’t seem to allow you to include the date, only the time of day. If you set the start and end times with the below formats, for example, then it does work.

    OLAppointment.Start = #11/26/2012 1:00:00 PM#
    OLAppointment.End = #11/26/2012 2:00:00 PM#
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am attempting to generate the body of an email in Outlook 2007 from
I am attempting to generate datamatrix barcodes from within itext. This works fine for
I am attempting to generate a list (from four tables) of products, classid, optionid,
I'm attempting to generate a grid of divs five elements wide from the objects
I'm attempting to run TextTransform.exe to generate code using a T4 template file. The
I am attempting to generate a mesh in unity from script. The mesh is
I am attempting to generate a multi-dimensional array with each sub array representing a
I am attempting to generate code using T4 Text Templating, but when running the
I am attempting to generate a potential card 'plays' list from a predetermined hand
I'm attempting to use svcutil.exe to generate -only- the service contracts (interfaces) from a

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.