How can I order the cursor within excel to move one cell to the right or to
copy cells?
After the copy command I would lijke to return to word and paste the cell
value.

Up till a few months ago it worked with sendkeys, but this doesn't seem to
work anymore.
Thank you

Re: Cursor movement in excel from word (sendkeys?) by Helmut

Helmut
Tue Sep 12 11:30:11 CDT 2006

Hi DeCock,

as in Word, don't move the cursor.

Sub test00001()
' early binding
' excel already running
Dim oExc As Excel.Application
Dim rTmp As Excel.Range
Set oExc = GetObject(, "Excel.application")
Set oWrk = oExc.ActiveWorkbook
Set oSht = oWrk.ActiveSheet
oSht.Cells(1, 1).Activate
Set rTmp = oExc.ActiveCell
MsgBox rTmp.Value ' for testing
MsgBox rTmp.Offset(0, 1).Value ' for testing
selection.Range.Text = rTmp.Offset(0, 1).Value
End Sub

Activates cell(1,1)
Gives you the value in the next cell of the same row.
Use rTmp.Offset(0, 2).Value for the second next cell etc.

HTH

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"

Re: Cursor movement in excel from word (sendkeys?) by DeCock

DeCock
Wed Sep 13 06:41:02 CDT 2006

Dear Helmut,
Thank you for your help.
I had to make some changes because the application is rather specific, but
it works thanks to you

Best regards

"Helmut Weber" wrote:

> Hi DeCock,
>
> as in Word, don't move the cursor.
>
> Sub test00001()
> ' early binding
> ' excel already running
> Dim oExc As Excel.Application
> Dim rTmp As Excel.Range
> Set oExc = GetObject(, "Excel.application")
> Set oWrk = oExc.ActiveWorkbook
> Set oSht = oWrk.ActiveSheet
> oSht.Cells(1, 1).Activate
> Set rTmp = oExc.ActiveCell
> MsgBox rTmp.Value ' for testing
> MsgBox rTmp.Offset(0, 1).Value ' for testing
> selection.Range.Text = rTmp.Offset(0, 1).Value
> End Sub
>
> Activates cell(1,1)
> Gives you the value in the next cell of the same row.
> Use rTmp.Offset(0, 2).Value for the second next cell etc.
>
> HTH
>
> --
> Greetings from Bavaria, Germany
>
> Helmut Weber, MVP WordVBA
>
> Win XP, Office 2003
> "red.sys" & Chr$(64) & "t-online.de"
>