Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Today's Date macro 1

Status
Not open for further replies.

rob7785

Technical User
Aug 4, 2011
11
0
0
GB
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
 
sess.putstring format(date,"mmddyy"), 1,2
 
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.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top