×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Today's Date macro

Today's Date macro

Today's Date macro

(OP)
Hi all

I Have created a Macro which makes a record of a
payment against a invoice it currently does every
thing I want it to except insert todays date in a
desired format.

Today = DateValue(now)
Sess1.screen.putstring Today

The result of this is 04/08/2011, the problem
here is that the format needs to be 040811
to Solve this I've tried.

Today = Day (Now)
Sess1.Screen.Putstring Today

But this return the date as single digit i.e 4
so for the moment I have set it to send keypad 0
before placeing the day number and month number bu i have to turn this feature off once the date gets to either the
10th or October I am trying achieve it to enter
the date in the desired format with out having to
remove parts of code every few wks and then
re-add them again, let me know if you want me to
put some screen shots on to make it more clear
what im doing and trying to achieve.

Thanks in advance below is the code im using.
Which has been majourly influanced by the help Skip
and Calculus have given on peoples posts.


' This section of code contains the recorded events
    Sess1.Screen.Sendkeys("<Find>NBABA<Ctrl+M>")          
    Sess1.Screen.Sendkeys("NB40<Ctrl+M>")    
    Sess1.Screen.Sendkeys("CREDIT CARD PAYMENT<Keypad 1><Keypad 2>/<Keypad 1><Keypad 1><Tab>")    
    Sess1.Screen.Sendkeys("<Keypad 1>")
        Sess1.Screen.WaitHostQuiet(g_HostSettleTime)
        Sess1.Screen.MoveTo 15, 35, 01    
    
'----------------------------------------------------------------
       Today = Day(Now)
       Sess1.Screen.SendKeys ("<Keypad 0>")
      Sess1.Screen.Putstring Today
'----------------------------------------------------------------
    Today = Month(Now)
     Sess1.Screen.SendKeys ("<Keypad 0>")
      Sess1.Screen.Putstring Today
'----------------------------------------------------------------
        Sess1.Screen.SendKeys ("<Keypad 1><Keypad 1>")
'----------------------------------------------------------------
         
        Sess1.Screen.Sendkeys("<Keypad 5>")    
    Sess1.Screen.Sendkeys("<Keypad .><Tab>")    
    Sess1.Screen.Sendkeys("<Keypad .><Tab>")    
    Sess1.Screen.Sendkeys("<Keypad .><Tab>")    
        Sess1.Screen.Sendkeys("<Keypad .><Tab>")
    Sess1.Screen.Sendkeys("SK1 2FB<Tab>")
    Sess1.Screen.Sendkeys("<Keypad 8>
<Keypad 1><Keypad 6><Keypad 4>")
        g_HostSettleTime = 0        ' milliseconds    
        Sess1.Screen.WaitHostQuiet(g_HostSettleTime)
        Sess1.Screen.MoveTo 15, 03, 01         
        Sess1.Screen.WaitHostQuiet(g_HostSettleTime)
        Sess1.Screen.Paste

'-----------------------------------------------------------------
   
        Dim waits as Object
    Set waits = System.Waits
        Dim w1 as Object
        Set w1 = sess1.Screen.Waitforkeys("<Keypad Enter>")
        id1 = waits.Add(w1)
        retval = waits.Wait(500000)

'-----------------------------------------------------------------
     
        Sess1.Screen.Waitforkeys("<Keypad Enter>")
        Sess1.Screen.Sendkeys("** COMPLETE **")     
    System.TimeoutValue = OldSystemTimeout

End Sub
 

RE: Today's Date macro

sess.putstring format(date,"mmddyy"), 1,2

RE: Today's Date macro

(OP)
vzachin you sir are a legend that was causing me a massive head ache cant believe it was staring me in the face the whole time thanks.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close