Substitute for SendKeys?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

If I click on a hyperlink in a worksheet that sends me to another location in
the workbook, I can return with ALT-BACKARROW. In VBA, I can return with:

Application.SendKeys "%{LEFT}"

Can I do the same thing without SendKeys?
 
Hmm, the references must be stored somewhere but try this workaround -

Sub test()
Dim c As CommandBarButton

Set c = CommandBars.FindControl(ID:=1017) ' Back
On Error Resume Next
c.Execute
If Err.Number Then
Set c = CommandBars.FindControl(ID:=1018) ' Forward
c.Execute
End If

End Sub

Regards,
Peter T
 
Thank you!
--
Gary''s Student - gsnu200750


Peter T said:
Hmm, the references must be stored somewhere but try this workaround -

Sub test()
Dim c As CommandBarButton

Set c = CommandBars.FindControl(ID:=1017) ' Back
On Error Resume Next
c.Execute
If Err.Number Then
Set c = CommandBars.FindControl(ID:=1018) ' Forward
c.Execute
End If

End Sub

Regards,
Peter T
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

SendKeys to emulate ALT+TAB, TAB, TAB 2
Edit a Cell 8
Sendkeys bug? Office 07 2
sendkey problem 2
Programming SendKeys 4
SendKeys variable 1
SendKeys on a locked PC 1
Interaction and SendKeys 2

Back
Top