Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
hi folks,
i've got a bit of a wriggler here. any help would be appreciated. in excel 2000 each workbook is opened in its own excel instance i.e.. i open file1.xls and file2.xls and i can see both on the taskbar and can use alt+tab to switch between them. i have written some custom menus in file1.xls which are added in the workbook_activate event and removed in the workbook_deactivate event. thus, in theory, when i switch between file1 and file2, the menus should appear in file1 and dissapear when i return to file2. this is however not the case. if i use the mouse to click on the instances in the task bar, there is no problem. however, if i use alt+tab, some of the time the menus are activated, and some of the time they aren't. i can't seem to find anything that this problem could be connected to. even if i use the following simple code in file1: Private Sub Workbook_Activate() MsgBox "workbook is active" End Sub and have file2 is a new document, i still get the problem. i switch with alt+tab from file1 to file2, and when i switch back, the msgbox is not displayed. i have noticed in the news groups that there are a number of people who have built custom menus. do you also have this problem, or haven't you noticed it, or doesn't it bother you? i like to work with the keyboard and it would be great if i could get this working. i have already tried to using the sheet_activate and window_activate events but they have same effect. does anyone know which event i need to use in order to _always_ trigger my macro when i move between windows or files? regards, gavin |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
If you're really opening multiple instances of excel, that's your problem.
Open those two workbooks the normal way. Then in one of the applications, click on window (on the menubar). Do you see both workbooks at the bottom of that list? If you don't, then you really have two instances running. And those two instances are separate and distinct. They don't talk to each other. Just like leaving excel and going to notepad/word/solitaire, then coming back to excel won't cause that workbook_active code to fire, neither will going to another instance of excel. I think you want to open both files in one instance of excel. But you can turn on windows in taskbar so that it looks like it does now. (Tools|Options|view tab|windows in taskbar). Then swapping between different workbooks in the same instance of excel will do what you want. If you click on an excel icon and it starts a new instance (check under window), you should be able to change this behavior by either: Close Excel and Start|Run excel.exe /regserver The /regserver stuff resets the windows registry to excel's factory defaults. If that doesn't work, try: Try Tools|Options|General|Ignore other applications (uncheck it) Gavin Frayne wrote: hi folks, i've got a bit of a wriggler here. any help would be appreciated. in excel 2000 each workbook is opened in its own excel instance i.e.. i open file1.xls and file2.xls and i can see both on the taskbar and can use alt+tab to switch between them. i have written some custom menus in file1.xls which are added in the workbook_activate event and removed in the workbook_deactivate event. thus, in theory, when i switch between file1 and file2, the menus should appear in file1 and dissapear when i return to file2. this is however not the case. if i use the mouse to click on the instances in the task bar, there is no problem. however, if i use alt+tab, some of the time the menus are activated, and some of the time they aren't. i can't seem to find anything that this problem could be connected to. even if i use the following simple code in file1: Private Sub Workbook_Activate() MsgBox "workbook is active" End Sub and have file2 is a new document, i still get the problem. i switch with alt+tab from file1 to file2, and when i switch back, the msgbox is not displayed. i have noticed in the news groups that there are a number of people who have built custom menus. do you also have this problem, or haven't you noticed it, or doesn't it bother you? i like to work with the keyboard and it would be great if i could get this working. i have already tried to using the sheet_activate and window_activate events but they have same effect. does anyone know which event i need to use in order to _always_ trigger my macro when i move between windows or files? regards, gavin -- Dave Peterson |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You are correct that using alt-tab does not fire the workbook activate event
whether the file1.xls and file2.xls are in the same instance of excel or in separate instances of excel. Your observation that the menus are sometimes changed is probably due to some other action and not due to Alt-tab. (I could be wrong, but I never saw the events fired). Dave Peterson said: Then swapping between different workbooks in the same instance of excel will do what you want. Using Excel 2000 under Windows XP, I found this not to be true when Alt-Tab was used to switch between windows. Perhaps Dave had a different experience. I suspect this is a bug. In separate instances of Excel, the current behavior makes sense, but in the same instance either Alt+Tab shouldn't work for child windows or it should fire the activate event. Regards, Tom Ogilvy Gavin Frayne wrote in message ... hi folks, i've got a bit of a wriggler here. any help would be appreciated. in excel 2000 each workbook is opened in its own excel instance i.e.. i open file1.xls and file2.xls and i can see both on the taskbar and can use alt+tab to switch between them. i have written some custom menus in file1.xls which are added in the workbook_activate event and removed in the workbook_deactivate event. thus, in theory, when i switch between file1 and file2, the menus should appear in file1 and dissapear when i return to file2. this is however not the case. if i use the mouse to click on the instances in the task bar, there is no problem. however, if i use alt+tab, some of the time the menus are activated, and some of the time they aren't. i can't seem to find anything that this problem could be connected to. even if i use the following simple code in file1: Private Sub Workbook_Activate() MsgBox "workbook is active" End Sub and have file2 is a new document, i still get the problem. i switch with alt+tab from file1 to file2, and when i switch back, the msgbox is not displayed. i have noticed in the news groups that there are a number of people who have built custom menus. do you also have this problem, or haven't you noticed it, or doesn't it bother you? i like to work with the keyboard and it would be great if i could get this working. i have already tried to using the sheet_activate and window_activate events but they have same effect. does anyone know which event i need to use in order to _always_ trigger my macro when i move between windows or files? regards, gavin |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Nope. I was just wrong.
I think I was thinking of workbook_activate. Tom Ogilvy wrote: You are correct that using alt-tab does not fire the workbook activate event whether the file1.xls and file2.xls are in the same instance of excel or in separate instances of excel. Your observation that the menus are sometimes changed is probably due to some other action and not due to Alt-tab. (I could be wrong, but I never saw the events fired). Dave Peterson said: Then swapping between different workbooks in the same instance of excel will do what you want. Using Excel 2000 under Windows XP, I found this not to be true when Alt-Tab was used to switch between windows. Perhaps Dave had a different experience. I suspect this is a bug. In separate instances of Excel, the current behavior makes sense, but in the same instance either Alt+Tab shouldn't work for child windows or it should fire the activate event. Regards, Tom Ogilvy Gavin Frayne wrote in message ... hi folks, i've got a bit of a wriggler here. any help would be appreciated. in excel 2000 each workbook is opened in its own excel instance i.e.. i open file1.xls and file2.xls and i can see both on the taskbar and can use alt+tab to switch between them. i have written some custom menus in file1.xls which are added in the workbook_activate event and removed in the workbook_deactivate event. thus, in theory, when i switch between file1 and file2, the menus should appear in file1 and dissapear when i return to file2. this is however not the case. if i use the mouse to click on the instances in the task bar, there is no problem. however, if i use alt+tab, some of the time the menus are activated, and some of the time they aren't. i can't seem to find anything that this problem could be connected to. even if i use the following simple code in file1: Private Sub Workbook_Activate() MsgBox "workbook is active" End Sub and have file2 is a new document, i still get the problem. i switch with alt+tab from file1 to file2, and when i switch back, the msgbox is not displayed. i have noticed in the news groups that there are a number of people who have built custom menus. do you also have this problem, or haven't you noticed it, or doesn't it bother you? i like to work with the keyboard and it would be great if i could get this working. i have already tried to using the sheet_activate and window_activate events but they have same effect. does anyone know which event i need to use in order to _always_ trigger my macro when i move between windows or files? regards, gavin -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Activate Workbook | Excel Discussion (Misc queries) | |||
Activate method of Worksheet class fails in Excel 2000 | Excel Discussion (Misc queries) | |||
Is Excel reliable | Excel Discussion (Misc queries) | |||
activate workbook w/unknown name | Excel Discussion (Misc queries) | |||
Workbook.activate | Excel Discussion (Misc queries) |