Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default A negative to using Application.Onkey

I have programmed an excel spreadsheet to activate a macro when the ENTER
button is pressed using the Application.Onkey command.

My problem is that if I then open another excel spreadsheet, and I press
ENTER, then the macro for the 1st speadsheet tries to run.

Is there a way to ensure that this macro runs only in the specific
speadsheet and not in every speadsheet I have open?

NB/ I have currently written the onkey command into Sheet1 of Microsoft
Excel Objects for the speadsheet.

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default A negative to using Application.Onkey

Set the key on the worbook activate event, and reset it on the workbook
deactivate event.

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Andybro" wrote in message
...
I have programmed an excel spreadsheet to activate a macro when the ENTER
button is pressed using the Application.Onkey command.

My problem is that if I then open another excel spreadsheet, and I press
ENTER, then the macro for the 1st speadsheet tries to run.

Is there a way to ensure that this macro runs only in the specific
speadsheet and not in every speadsheet I have open?

NB/ I have currently written the onkey command into Sheet1 of Microsoft
Excel Objects for the speadsheet.

Thanks



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default A negative to using Application.Onkey

Thanks Bob - I will give it a go (new to VBA so learning as I go along).

"Bob Phillips" wrote:

Set the key on the worbook activate event, and reset it on the workbook
deactivate event.

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Andybro" wrote in message
...
I have programmed an excel spreadsheet to activate a macro when the ENTER
button is pressed using the Application.Onkey command.

My problem is that if I then open another excel spreadsheet, and I press
ENTER, then the macro for the 1st speadsheet tries to run.

Is there a way to ensure that this macro runs only in the specific
speadsheet and not in every speadsheet I have open?

NB/ I have currently written the onkey command into Sheet1 of Microsoft
Excel Objects for the speadsheet.

Thanks




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default A negative to using Application.Onkey

Do you understand that Workbook activate and deactivate code MUST go in the
ThisWorkbook code module?

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Andybro" wrote in message
...
Thanks Bob - I will give it a go (new to VBA so learning as I go along).

"Bob Phillips" wrote:

Set the key on the worbook activate event, and reset it on the workbook
deactivate event.

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my
addy)

"Andybro" wrote in message
...
I have programmed an excel spreadsheet to activate a macro when the
ENTER
button is pressed using the Application.Onkey command.

My problem is that if I then open another excel spreadsheet, and I
press
ENTER, then the macro for the 1st speadsheet tries to run.

Is there a way to ensure that this macro runs only in the specific
speadsheet and not in every speadsheet I have open?

NB/ I have currently written the onkey command into Sheet1 of Microsoft
Excel Objects for the speadsheet.

Thanks






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default A negative to using Application.Onkey

No - I can accept this but I don't understand why. The activate and
deactivate events are available for each sheet, but I will follow your
instruction.
Thanks

"Bob Phillips" wrote:

Do you understand that Workbook activate and deactivate code MUST go in the
ThisWorkbook code module?

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Andybro" wrote in message
...
Thanks Bob - I will give it a go (new to VBA so learning as I go along).

"Bob Phillips" wrote:

Set the key on the worbook activate event, and reset it on the workbook
deactivate event.

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my
addy)

"Andybro" wrote in message
...
I have programmed an excel spreadsheet to activate a macro when the
ENTER
button is pressed using the Application.Onkey command.

My problem is that if I then open another excel spreadsheet, and I
press
ENTER, then the macro for the 1st speadsheet tries to run.

Is there a way to ensure that this macro runs only in the specific
speadsheet and not in every speadsheet I have open?

NB/ I have currently written the onkey command into Sheet1 of Microsoft
Excel Objects for the speadsheet.

Thanks








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default A negative to using Application.Onkey

They are, but we are talking about WORKBOOK activate,deactivate.

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Andybro" wrote in message
...
No - I can accept this but I don't understand why. The activate and
deactivate events are available for each sheet, but I will follow your
instruction.
Thanks

"Bob Phillips" wrote:

Do you understand that Workbook activate and deactivate code MUST go in
the
ThisWorkbook code module?

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my
addy)

"Andybro" wrote in message
...
Thanks Bob - I will give it a go (new to VBA so learning as I go
along).

"Bob Phillips" wrote:

Set the key on the worbook activate event, and reset it on the
workbook
deactivate event.

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my
addy)

"Andybro" wrote in message
...
I have programmed an excel spreadsheet to activate a macro when the
ENTER
button is pressed using the Application.Onkey command.

My problem is that if I then open another excel spreadsheet, and I
press
ENTER, then the macro for the 1st speadsheet tries to run.

Is there a way to ensure that this macro runs only in the specific
speadsheet and not in every speadsheet I have open?

NB/ I have currently written the onkey command into Sheet1 of
Microsoft
Excel Objects for the speadsheet.

Thanks








  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default A negative to using Application.Onkey

Bob, you need to change your name to "The Oracle".

All done and working. Big Thanks.
Andy

"Bob Phillips" wrote:

They are, but we are talking about WORKBOOK activate,deactivate.

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Andybro" wrote in message
...
No - I can accept this but I don't understand why. The activate and
deactivate events are available for each sheet, but I will follow your
instruction.
Thanks

"Bob Phillips" wrote:

Do you understand that Workbook activate and deactivate code MUST go in
the
ThisWorkbook code module?

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my
addy)

"Andybro" wrote in message
...
Thanks Bob - I will give it a go (new to VBA so learning as I go
along).

"Bob Phillips" wrote:

Set the key on the worbook activate event, and reset it on the
workbook
deactivate event.

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my
addy)

"Andybro" wrote in message
...
I have programmed an excel spreadsheet to activate a macro when the
ENTER
button is pressed using the Application.Onkey command.

My problem is that if I then open another excel spreadsheet, and I
press
ENTER, then the macro for the 1st speadsheet tries to run.

Is there a way to ensure that this macro runs only in the specific
speadsheet and not in every speadsheet I have open?

NB/ I have currently written the onkey command into Sheet1 of
Microsoft
Excel Objects for the speadsheet.

Thanks









Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Application.onKey non-functioning Madhan Excel Programming 4 December 21st 06 04:39 PM
How to apply Application.OnKey dewanna Excel Programming 1 April 7th 06 07:16 AM
Application.OnKey Norman Jones Excel Programming 0 January 27th 05 01:26 AM
application.onkey doesn't work bob Excel Programming 2 May 10th 04 11:06 AM
Application.OnKey problem Phillip Reeves[_2_] Excel Programming 1 January 23rd 04 06:46 PM


All times are GMT +1. The time now is 12:15 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"