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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sendkeys and Word 2010

Status
Not open for further replies.

boozer99

Technical User
Feb 19, 2013
3
US
Does anyone have issues with Sendkeys in Microsoft Word 2010?
Since install the macro shows an error on line 82 which is
Sendkeys "^V"
which should paste what was copied in Extra to Word but
no longer works.
 
hi,

and your code using sendkeys?

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Sendkeys "^V" is Alt V which is paste and worked fine from Extra before Windows 7 and Office 2010 was installed.

' This section of code contains the script needed to copy & paste an area on the screen

Dim Sys As Object, Sess As Object, MyScreen As Object, MyArea As Object

Set Sys = CreateObject("EXTRA.System")
Set Sess = Sys.ActiveSession
Set MyScreen = Sess.Screen
Set MyArea = MyScreen.Area(9, 15, 9, 48)
MyArea.Select
Sess0.Screen.Copy

Set MyArea = MyScreen.Area(14, 20, 15, 48)
MyArea.Select
Sess0.Screen.CopyAppend

Set MyArea = MyScreen.Area(15, 55, 15, 56)
MyArea.Select
Sess0.Screen.CopyAppend

Set MyArea = MyScreen.Area(15, 63, 15, 72)
MyArea.Select
Sess0.Screen.CopyAppend

g_HostSettleTime = 400 ' milliseconds

AppActivate "5162Labels.docm - Microsoft Word"
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sendkeys "^v"

Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sendkeys "{Down}"
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)

g_HostSettleTime = 200 ' milliseconds

System.TimeoutValue = OldSystemTimeout
End Sub
 
Hi,

Think about it!

Your program WAITS a fixed period of time for your asynchronous emulator to return control! Kinda like waiting at a stoplight just 5 seconds and then gunning it thru the intersection regardless if the light has changed or not!

Rather wait for the emulator to return control and then proceed
Code:
Sendkeys("<^v>")
Do until Sess0.screen.waitforcursor(r, c)
  Doevents
Loop
Where r, c is the rest coordinates for the screen.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Thanks Skip I'll try that soon as I get a chance
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top