VB Dummy

I have inherited a vacation request form.  In the start and stop dates there is a macro.  Right now when somebody tabs onto the start or stop date a calendar comes up for the year 2000.  You can change it and select any other date you wish but I would like the calendar to pop up with the current date.  I am enclosing the macro below.  Is there any entry I can insert or deltete to make this happen   Thank you for any assistance with this.

 Option Explicit
Public sDate As String  'used to write value from calendar form to form field
Public fFlag As Boolean     'did they cancel in calendar

 

Sub usbStartDate()
'This is the code called by start date form field
    
    Const sfield As String = "txtStartDate"
    frmCalendar.Show
   
    If fFlag Then   'They hit enter date button
        ActiveDocument.FormFields(sfield).Result = sDate    'Enter the date
    Else    'They hit cancel
        MsgBox "Date selection was cancelled. Please select a date"
        usbStartDate    'Keep running until date is selected
    End If
   
End Sub

Sub usbEndDate()
'This is the code called by end date form field
   
    Const sfield As String = "txtEndDate"
    frmCalendar.Show
   
    If fFlag Then   'They hit enter date button
        ActiveDocument.FormFields(sfield).Result = sDate    'Enter the date
    Else    'They hit cancel
        MsgBox "Date selection was cancelled. Please select a date"
        usbStartDate    'Keep running until date is selected
    End If
   
End Sub       




Answer this question

VB Dummy

  • shawaj

    You should look for a file named frmCalender.vb. If you cannot find it you may mail the entire form.

  • Paic Citron

    I think you'll habe to look in the frmCalender-code. Or post that code here.

  • _Jon_

    I appreciate the assistance but unfortunately, I have no idea of what you are talking about.  I am truly a VB Dummy.  Not a clue.



  • ZAP

    Where would I look for this   And once I find it, what do I do with it

  • Eckmar

    Sorry I took so long.  The macro I am refering to is is the from & to boxes.  Any assistance you can give would be greatly appreciated.

    Johnson
    < xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" />County ECC< xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

                  

    Absence Request

    < xml:namespace prefix = v ns = "urn:schemas-microsoft-com:vml" />

    Absence Information

     

     


     

        Employee Name:                                                     Date & time of request:  11/05/2005 01:18

        Employee Number:                                                                         Department: 

        Manager:       

        Type of Absence Requested:

      Scheduled Sick          Vacation/Floating     Bereavement             Military

      Jury Duty                FMLA                    Other (reason)     

      Dates of Absence:  From:        Thru:                                     

      Reason for Absence:     

     

      You must submit requests for absences, other than sick leave or bereavement, thirty days prior to the first day you will be absent.

     

    __________________________________________________________________________________

      Employee Signature ______________________________________                              Date: ___________________

      Supervisor Signature     ______________________________________                        Date:  ___________________

    Absence Information

     

    Scheduling Supervisor Approval

     


     

    Disposition:

                                                                                                   

     

    Schedulling Supervisor Signature______________________________________              Date:  ___________________



  • Glyn123

    I cannot find any reference to Form_Load event.  As I stated, I inherited this form and have absolutely no VB knowldedge.  If I send you a copy can you just place the calendar1.value = now where it belongs   Thank You.



  • Michael McCormack

    It does not show up in any of the directories.  It seems like a lost cause.

  • SergioX

    Hi,


    Are you referring to an Excel or Word Macro If so, you can find frmCalendar in the left side of the Macro Editor (Project Explorer window) open it then click the calendar control and look at its properties to see what name it was given. Upon knowing the name double click your form to automatically create a Form_Load event. In the Form_Load Event place this code:

    nameOfTheCalendarControl.Value = Now




    cheers,

    Paul June A. Domag

  • zviruga

    I found the name of the calendar to "calendar1".  However as you can see in the macro I inserted earlier, there is no line for "name of the calendarcontrol.value" so I have no idea of where to put the code you have shown me.  I am truly a VB Dummy.  "Cheers" as in Great Britain

  • Pawan Jain

    Hi,


    Sure. Just send it to my e-mail address on my profiles...






    cheers,

    Paul June A. Domag


  • Lukasz Pawlowski

    Hi,

    You can place the code that I have given on the Form_Load event. You can create this by double-clicking on your form. This would bring the code editor and you can just type:

    calendar1.Value = Now
    ' since calendar is the name of your calendar control.





    cheers,

    Paul June A. Domag


  • Jim Thatcher

    The easiest answer is to automaticaly search your drives for al files named *.vb.

    But it should be somewhere in directory you installed your request form in.

  • VB Dummy