none
How I get value from activeX control - calendar RRS feed

  • Question

  • I 'm building form in Word 2010. I put activeX control calendar some like:

    from <calendar formant> to <calendar format> its <label> days

    ex: from 25.07 to 27.07 its 3 days

    and I need calculate number of days.

    so I don't know how to do it? In excel I have events but in word I don't see it.

    Friday, April 12, 2013 1:27 PM

All replies

  • If you have two calendar controls on your userform:

    Private Sub CommandButton1_Click()
    MsgBox "From " & Me.Calendar1.Value & " to " & _
        Me.Calendar2.Value & " is " & _
        Me.Calendar2.Value - Me.Calendar1.Value + 1 & " days."
    End Sub

    If you have two calendar controls in your document, click the design mode button, double click the control with the later date (assumed to be Calendar2) and paste this in the window that appears:

    Private Sub Calendar2_Click()
    MsgBox "From " & Calendar1.Value & " to " & _
        Calendar2.Value & " is " & _
        Calendar2.Value - Calendar1.Value + 1 & " days."
    End Sub

    Friday, April 12, 2013 3:03 PM
  • Ok, I try double klick on form component calendar but nothing happened.  In excel I 've feature show code but in word I haven't. I put control using ribbon Developer and click icon calendar.  In properties I've only data like subject/tag - nothing special. 

    Monday, April 15, 2013 12:28 PM