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
 
Back
Top