ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Substitute for SendKeys? (https://www.excelbanter.com/excel-programming/399467-substitute-sendkeys.html)

Gary''s Student

Substitute for SendKeys?
 
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?
--
Gary''s Student - gsnu200750

Peter T

Substitute for 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



"Gary''s Student" wrote in message
...
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?
--
Gary''s Student - gsnu200750




Gary''s Student

Substitute for SendKeys?
 
Thank you!
--
Gary''s Student - gsnu200750


"Peter T" wrote:

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



"Gary''s Student" wrote in message
...
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?
--
Gary''s Student - gsnu200750





Bob Umlas, Excel MVP

Substitute for SendKeys?
 
Application.Goto
Yes, without supplying anything.
Bob Umlas
Excel MVP


"Gary''s Student" wrote:

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?
--
Gary''s Student - gsnu200750


Gary''s Student

Substitute for SendKeys?
 
Absolutely amazing !
Thank you !

I guess I am still a Student
--
Gary''s Student - gsnu200750


"Bob Umlas, Excel MVP" wrote:

Application.Goto
Yes, without supplying anything.
Bob Umlas
Excel MVP


"Gary''s Student" wrote:

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?
--
Gary''s Student - gsnu200750


Peter T

Substitute for SendKeys?
 
Cute !

What about Forward ?

Regards,
Peter T

<Bob Umlas; "Excel MVP" wrote
in message ...
Application.Goto
Yes, without supplying anything.
Bob Umlas
Excel MVP


"Gary''s Student" wrote:

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?
--
Gary''s Student - gsnu200750





All times are GMT +1. The time now is 07:11 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com