I have run the following piece of code numerous times a day for the past few years without any problems (it basically uses the send keys to run an excel add in to extract data from an AS400 database).
However, we recently upgraded to excel 2007, and now each time I run the code, it turns off the number lock. I have no idea why it is doing this. Could it be the sequence of sendkey commands or something else?? I'm very confused and it's getting a little frustrating!
However, we recently upgraded to excel 2007, and now each time I run the code, it turns off the number lock. I have no idea why it is doing this. Could it be the sequence of sendkey commands or something else?? I'm very confused and it's getting a little frustrating!
Code:
Private Sub CommandButton1_Click()
With Range("TimeStamp")
.Select
.FormulaR1C1 = "=now()"
.Copy
.PasteSpecial xlPasteValues
End With
Range("User").Value = Environ("Username")
Range("DataStart:$CC$20000").ClearContents
Range("DataStart").Select
SendKeys "%{x}"
SendKeys "+{r}"
SendKeys "+{n}"
SendKeys "{ENTER}"
SendKeys "EQUATORRE-PROD.QBE.EO"
SendKeys "{ENTER}"
SendKeys Range("Queryname").Value
SendKeys "{ENTER}"
SendKeys "{ENTER}"
SendKeys "{ENTER}"
End Sub
Last edited by a moderator: