Roy, many thanks you've convinced me it's possible to get my data onto the
next tab and I agree that sendkeys is not the best way to do it - but as my
knowledge of VB is limited it's usually reliable enough for a quick fix to a
problem.
If I have an Excel SS called: Genesys data input.xls and my first set of
data is on a tab called 'contract' in cells a1:k1 and my 2nd set of data is
on a tab called contractavail in cells b3
3, how would I convert the
sendkeys code I've written below into a VB script that would achieve the same
results in a more reliable way. This would be an invaluable example which I
could build on for future work.
The first tab I'm sending the 'contracts' data to is called ""WFM
Configuration Utility - Contracts" and the code is as follows:
AppActivate "WFM Configuration Utility - Contracts"
With ThisWorkbook.Sheets("contract")
Application.ScreenUpdating = False
SendKeys "{TAB}"
SendKeys .Range("B1").Value
SendKeys "{TAB}"
SendKeys "{TAB}"
SendKeys .Range("c1").Value
SendKeys "{TAB}"
SendKeys .Range("d1").Value
SendKeys "{TAB}"
SendKeys .Range("e1").Value
SendKeys "{TAB}"
SendKeys .Range("f1").Value
SendKeys "{TAB}"
SendKeys .Range("g1").Value
SendKeys "{TAB}"
SendKeys .Range("h1").Value
SendKeys "{TAB}"
SendKeys .Range("i1").Value
SendKeys "{TAB}"
SendKeys "{TAB}"
SendKeys .Range("j1").Value
SendKeys "{TAB}"
SendKeys .Range("k1").Value
Sheets("contract").Select
Range("A1:z1").Select
Selection.Delete Shift:=xlUp 'Application.Run "'Genesys data
input.xls'!gostart"
Sheets("Start").Select
End With
End Sub
The 2nd tab
I've used the following code to activate the 2nd tab that I want to get data
from the contractavail tab in Excel to is activated as a separate routine,
therfore I activate the window again as "WFM Configuration Utility -
Contracts" and use this:
AppActivate "WFM Configuration Utility - Contracts"
With ThisWorkbook.Sheets("contractavail")
Application.ScreenUpdating = False
SendKeys "{TAB}"
SendKeys .Range("c3").Value
SendKeys "{TAB}"
SendKeys .Range("d3").Value
SendKeys "{TAB}"
SendKeys "{TAB}"
SendKeys .Range("e3").Value
SendKeys "{TAB}"
SendKeys .Range("f3").Value
SendKeys "{TAB}"
SendKeys "{TAB}"
SendKeys .Range("g3").Value
SendKeys "{TAB}"
SendKeys .Range("h3").Value
SendKeys "{TAB}"
SendKeys "{TAB}"
SendKeys .Range("i3").Value
SendKeys "{TAB}"
SendKeys .Range("j3").Value
SendKeys "{TAB}"
SendKeys "{TAB}"
SendKeys .Range("k3").Value
SendKeys "{TAB}"
SendKeys .Range("l3").Value
SendKeys "{TAB}"
SendKeys "{TAB}"
SendKeys .Range("m3").Value
SendKeys "{TAB}"
SendKeys .Range("n3").Value
SendKeys "{TAB}"
SendKeys "{TAB}"
SendKeys .Range("o3").Value
SendKeys "{TAB}"
SendKeys .Range("p3").Value
Sheets("contractavail").Select
Range("b3
3").Select
Selection.Delete Shift:=xlUp '
Sheets("Start").Select
End With
End Sub
I do appreciate this is a very clumsy, long winded and inaccurate way to get
the result I want but it does work so for now I'm reasonably happy but would
like to improve the way I do things!
Any help would be greatly appreciated!