ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Change default F12 (https://www.excelbanter.com/excel-programming/425373-change-default-f12.html)

dimitris

Change default F12
 
Hello there,

is it possible to change the F12 button from "Save As" and when the user
press it to be equal as he had press "Enter" Button?
Also I would like to know if I can change the built-in shortcut for the
"Save As" from F2 to something else.

thanks

Dimitris

dimitris

Change default F12
 
Correction to the last sentence: ...from F12 to something else.

"Dimitris" wrote:

Hello there,

is it possible to change the F12 button from "Save As" and when the user
press it to be equal as he had press "Enter" Button?
Also I would like to know if I can change the built-in shortcut for the
"Save As" from F2 to something else.

thanks

Dimitris


Peter T

Change default F12
 
You can assign F12 to some other macro that does nothing, see OnKey in help.
But unless you need F12 for other purposes what harm is it doing.

What's wrong with Ctrl-s as a built-in alternative to F12, or Alt-f, a.

Regards,
Peter T

"Dimitris" wrote in message
...
Hello there,

is it possible to change the F12 button from "Save As" and when the user
press it to be equal as he had press "Enter" Button?
Also I would like to know if I can change the built-in shortcut for the
"Save As" from F2 to something else.

thanks

Dimitris




dimitris

Change default F12
 
With this line can I call Enter when I press F12 : Application.OnKey
"{F12}", "{ENTER}"

It is not working to me and I have the message:"I can not Find the macro
ENTER.

Thanks

Dimitris

"Peter T" wrote:

You can assign F12 to some other macro that does nothing, see OnKey in help.
But unless you need F12 for other purposes what harm is it doing.

What's wrong with Ctrl-s as a built-in alternative to F12, or Alt-f, a.

Regards,
Peter T

"Dimitris" wrote in message
...
Hello there,

is it possible to change the F12 button from "Save As" and when the user
press it to be equal as he had press "Enter" Button?
Also I would like to know if I can change the built-in shortcut for the
"Save As" from F2 to something else.

thanks

Dimitris





Peter T

Change default F12
 
Sub test()
OnKeyEdit 1 ' 0 to reset to default
End Sub

Sub OnKeyEdit(SetType As Long)
Dim sMacro As String
If SetType = 0 Then
' reset default
Application.OnKey "{F12}"
Else
If SetType = 1 Then
sMacro = "EditCell"
Else
' some other number to send an empty string
' and clear F12 of any action, even default
End If
Application.OnKey "{F12}", sMacro
End If

End Sub

Sub EditCell()
Application.SendKeys ("{F2}")
End Sub


Regards,
Peter T

"Dimitris" wrote in message
...
With this line can I call Enter when I press F12 : Application.OnKey
"{F12}", "{ENTER}"

It is not working to me and I have the message:"I can not Find the macro
ENTER.

Thanks

Dimitris

"Peter T" wrote:

You can assign F12 to some other macro that does nothing, see OnKey in
help.
But unless you need F12 for other purposes what harm is it doing.

What's wrong with Ctrl-s as a built-in alternative to F12, or Alt-f, a.

Regards,
Peter T

"Dimitris" wrote in message
...
Hello there,

is it possible to change the F12 button from "Save As" and when the
user
press it to be equal as he had press "Enter" Button?
Also I would like to know if I can change the built-in shortcut for the
"Save As" from F2 to something else.

thanks

Dimitris







dimitris

Change default F12
 
Thanks a lot Peter

Dimitris

"Peter T" wrote:

Sub test()
OnKeyEdit 1 ' 0 to reset to default
End Sub

Sub OnKeyEdit(SetType As Long)
Dim sMacro As String
If SetType = 0 Then
' reset default
Application.OnKey "{F12}"
Else
If SetType = 1 Then
sMacro = "EditCell"
Else
' some other number to send an empty string
' and clear F12 of any action, even default
End If
Application.OnKey "{F12}", sMacro
End If

End Sub

Sub EditCell()
Application.SendKeys ("{F2}")
End Sub


Regards,
Peter T

"Dimitris" wrote in message
...
With this line can I call Enter when I press F12 : Application.OnKey
"{F12}", "{ENTER}"

It is not working to me and I have the message:"I can not Find the macro
ENTER.

Thanks

Dimitris

"Peter T" wrote:

You can assign F12 to some other macro that does nothing, see OnKey in
help.
But unless you need F12 for other purposes what harm is it doing.

What's wrong with Ctrl-s as a built-in alternative to F12, or Alt-f, a.

Regards,
Peter T

"Dimitris" wrote in message
...
Hello there,

is it possible to change the F12 button from "Save As" and when the
user
press it to be equal as he had press "Enter" Button?
Also I would like to know if I can change the built-in shortcut for the
"Save As" from F2 to something else.

thanks

Dimitris







dimitris

Change default F12
 
Good afternoon from Greece

One more last question. If you are in a cell in edit mode and press F12
excel ignore the previous code and the F12 is again Save as.... How can i
Pass this problem? If you are not in the cell but you have just select it,
the code work perfect

Thanks...


"Dimitris" wrote:

Thanks a lot Peter

Dimitris

"Peter T" wrote:

Sub test()
OnKeyEdit 1 ' 0 to reset to default
End Sub

Sub OnKeyEdit(SetType As Long)
Dim sMacro As String
If SetType = 0 Then
' reset default
Application.OnKey "{F12}"
Else
If SetType = 1 Then
sMacro = "EditCell"
Else
' some other number to send an empty string
' and clear F12 of any action, even default
End If
Application.OnKey "{F12}", sMacro
End If

End Sub

Sub EditCell()
Application.SendKeys ("{F2}")
End Sub


Regards,
Peter T

"Dimitris" wrote in message
...
With this line can I call Enter when I press F12 : Application.OnKey
"{F12}", "{ENTER}"

It is not working to me and I have the message:"I can not Find the macro
ENTER.

Thanks

Dimitris

"Peter T" wrote:

You can assign F12 to some other macro that does nothing, see OnKey in
help.
But unless you need F12 for other purposes what harm is it doing.

What's wrong with Ctrl-s as a built-in alternative to F12, or Alt-f, a.

Regards,
Peter T

"Dimitris" wrote in message
...
Hello there,

is it possible to change the F12 button from "Save As" and when the
user
press it to be equal as he had press "Enter" Button?
Also I would like to know if I can change the built-in shortcut for the
"Save As" from F2 to something else.

thanks

Dimitris







Peter T

Change default F12
 
Yes I see what you mean.

Normally when in edit mode all code is suspended. Besides F12 I'm also
surprised to see F1 and F7 appear to work. I don't know how to avoid that
and suspect it's not possible, at least not with normal VBA methods.

Look again at the code I posted and notice how if you pass say '2' to the
OnKeyEdit routine it disables F12 as a SaveAs shortcut (as intended).
However if you enter edit mode then press F12, it will call the SaveAs
dialog. Exit edit mode and the F12 key reverts to being disabled. I have
never noticed that behaviour before.

Regards,
Peter T


"Dimitris" wrote in message
...
Good afternoon from Greece

One more last question. If you are in a cell in edit mode and press F12
excel ignore the previous code and the F12 is again Save as.... How can
i
Pass this problem? If you are not in the cell but you have just select it,
the code work perfect

Thanks...


"Dimitris" wrote:

Thanks a lot Peter

Dimitris

"Peter T" wrote:

Sub test()
OnKeyEdit 1 ' 0 to reset to default
End Sub

Sub OnKeyEdit(SetType As Long)
Dim sMacro As String
If SetType = 0 Then
' reset default
Application.OnKey "{F12}"
Else
If SetType = 1 Then
sMacro = "EditCell"
Else
' some other number to send an empty string
' and clear F12 of any action, even default
End If
Application.OnKey "{F12}", sMacro
End If

End Sub

Sub EditCell()
Application.SendKeys ("{F2}")
End Sub


Regards,
Peter T

"Dimitris" wrote in message
...
With this line can I call Enter when I press F12 :
Application.OnKey
"{F12}", "{ENTER}"

It is not working to me and I have the message:"I can not Find the
macro
ENTER.

Thanks

Dimitris

"Peter T" wrote:

You can assign F12 to some other macro that does nothing, see OnKey
in
help.
But unless you need F12 for other purposes what harm is it doing.

What's wrong with Ctrl-s as a built-in alternative to F12, or Alt-f,
a.

Regards,
Peter T

"Dimitris" wrote in message
...
Hello there,

is it possible to change the F12 button from "Save As" and when
the
user
press it to be equal as he had press "Enter" Button?
Also I would like to know if I can change the built-in shortcut
for the
"Save As" from F2 to something else.

thanks

Dimitris









dimitris

Change default F12
 
The problem that I have to deal with is that I will pass values from a
barcode reader. The reader have a predifed suffix that it is F12 and i must
not change it. With the code (not in edit mode in a cell) everything works
perfect. But in my case the barcode pass the data in edit mode in the cell
and so I can not bypass the F12.

And this is a big problem for me.

Thanks anyway Peter. If you found something I would be very happy to hear it.

Dimitris
"Peter T" wrote:

Yes I see what you mean.

Normally when in edit mode all code is suspended. Besides F12 I'm also
surprised to see F1 and F7 appear to work. I don't know how to avoid that
and suspect it's not possible, at least not with normal VBA methods.

Look again at the code I posted and notice how if you pass say '2' to the
OnKeyEdit routine it disables F12 as a SaveAs shortcut (as intended).
However if you enter edit mode then press F12, it will call the SaveAs
dialog. Exit edit mode and the F12 key reverts to being disabled. I have
never noticed that behaviour before.

Regards,
Peter T


"Dimitris" wrote in message
...
Good afternoon from Greece

One more last question. If you are in a cell in edit mode and press F12
excel ignore the previous code and the F12 is again Save as.... How can
i
Pass this problem? If you are not in the cell but you have just select it,
the code work perfect

Thanks...


"Dimitris" wrote:

Thanks a lot Peter

Dimitris

"Peter T" wrote:

Sub test()
OnKeyEdit 1 ' 0 to reset to default
End Sub

Sub OnKeyEdit(SetType As Long)
Dim sMacro As String
If SetType = 0 Then
' reset default
Application.OnKey "{F12}"
Else
If SetType = 1 Then
sMacro = "EditCell"
Else
' some other number to send an empty string
' and clear F12 of any action, even default
End If
Application.OnKey "{F12}", sMacro
End If

End Sub

Sub EditCell()
Application.SendKeys ("{F2}")
End Sub


Regards,
Peter T

"Dimitris" wrote in message
...
With this line can I call Enter when I press F12 :
Application.OnKey
"{F12}", "{ENTER}"

It is not working to me and I have the message:"I can not Find the
macro
ENTER.

Thanks

Dimitris

"Peter T" wrote:

You can assign F12 to some other macro that does nothing, see OnKey
in
help.
But unless you need F12 for other purposes what harm is it doing.

What's wrong with Ctrl-s as a built-in alternative to F12, or Alt-f,
a.

Regards,
Peter T

"Dimitris" wrote in message
...
Hello there,

is it possible to change the F12 button from "Save As" and when
the
user
press it to be equal as he had press "Enter" Button?
Also I would like to know if I can change the built-in shortcut
for the
"Save As" from F2 to something else.

thanks

Dimitris











All times are GMT +1. The time now is 10:05 AM.

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