Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I need to run two Excel applications. Each has a different name and different
content. The problem is that when I open a Userform in one, and I click to select the second application, the Userform of the first application continues to show. While the Userform in one continues to be active, I cannot work or open the Userforms of the other. Has anyone ever experience this issue? How do I bypass it? Note: this does not seem to have anything to do with wether the Userform is Modal or Modaless |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Edward,
Whilst you can have multiple workbooks open in the same instance of Excel, only one of them can be active at a time. Also only one thread of code can execute at a time. Depending what you are trying to achieve, you hide/show userforms in another's Activate/Deactivate event or in the same events for the worksheets. Obviously, if you are showing a userform vbModal (the default value), you cannot interact with other objects until you have hidden or unloaded that form. NickHK "Edward" wrote in message ... I need to run two Excel applications. Each has a different name and different content. The problem is that when I open a Userform in one, and I click to select the second application, the Userform of the first application continues to show. While the Userform in one continues to be active, I cannot work or open the Userforms of the other. Has anyone ever experience this issue? How do I bypass it? Note: this does not seem to have anything to do with wether the Userform is Modal or Modaless |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Again, let me state that this problem does not seem to have anything to do
with whether the Userform is Modal. Try this: 1 - create two Excel files, call them Model 1 and Model 2 2 - add an userform to each UserForm1 and UserForm2 3 - create a simple macro in each Project to open these userforms using the Show method 4 - set each userform to be Modaless 5 - having both workbooks Model 1 and Model 2 open, open UserForm1 6 - then open UserForm2 Both UserForm1 and UserForm2 should show on the screen regarless of which Workbook you are making the active one. I don't the want this behaviour. Other programs such Access don't behave like this. Does anyone know how to make Excel only show UserForm1 when Model 1 is the active workbook, and to only show UserForm2 when Model 2 is the active one. Ed "NickHK" wrote: Edward, Whilst you can have multiple workbooks open in the same instance of Excel, only one of them can be active at a time. Also only one thread of code can execute at a time. Depending what you are trying to achieve, you hide/show userforms in another's Activate/Deactivate event or in the same events for the worksheets. Obviously, if you are showing a userform vbModal (the default value), you cannot interact with other objects until you have hidden or unloaded that form. NickHK "Edward" wrote in message ... I need to run two Excel applications. Each has a different name and different content. The problem is that when I open a Userform in one, and I click to select the second application, the Userform of the first application continues to show. While the Userform in one continues to be active, I cannot work or open the Userforms of the other. Has anyone ever experience this issue? How do I bypass it? Note: this does not seem to have anything to do with wether the Userform is Modal or Modaless |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Difficult to know how Nick could have given any clearer information than he
did on the basis of your OP, catered for scenarios you didn't previously clarify, including the one you have now. Again, let me state that this problem does not seem to have anything to do with whether the Userform is Modal. It has everything to do wither whether the forms are modal/modeless. With a modal form the only way you could activate another workbook or run a form in another workbook is via code in the form, say activated from a button. For your situation with two modeless forms try running same in two workbooks (pretty much along the lines already suggested) - 'normal module Public gbUF1 As Boolean Sub showFormModeless() UserForm1.Show vbModeless End Sub 'userform1 Private Sub UserForm_Initialize() Me.Caption = ThisWorkbook.Name ThisWorkbook.Activate gbUF1 = True End Sub Private Sub UserForm_Terminate() gbUF1 = False End Sub 'thisworkbook module Private Sub Workbook_Activate() If gbUF1 Then UserForm1.Show vbModeless End Sub Private Sub Workbook_Deactivate() If gbUF1 Then UserForm1.Hide End Sub Various other ways depending on what you are doing. Regards, Peter T "Edward" wrote in message ... Again, let me state that this problem does not seem to have anything to do with whether the Userform is Modal. Try this: 1 - create two Excel files, call them Model 1 and Model 2 2 - add an userform to each UserForm1 and UserForm2 3 - create a simple macro in each Project to open these userforms using the Show method 4 - set each userform to be Modaless 5 - having both workbooks Model 1 and Model 2 open, open UserForm1 6 - then open UserForm2 Both UserForm1 and UserForm2 should show on the screen regarless of which Workbook you are making the active one. I don't the want this behaviour. Other programs such Access don't behave like this. Does anyone know how to make Excel only show UserForm1 when Model 1 is the active workbook, and to only show UserForm2 when Model 2 is the active one. Ed "NickHK" wrote: Edward, Whilst you can have multiple workbooks open in the same instance of Excel, only one of them can be active at a time. Also only one thread of code can execute at a time. Depending what you are trying to achieve, you hide/show userforms in another's Activate/Deactivate event or in the same events for the worksheets. Obviously, if you are showing a userform vbModal (the default value), you cannot interact with other objects until you have hidden or unloaded that form. NickHK "Edward" wrote in message ... I need to run two Excel applications. Each has a different name and different content. The problem is that when I open a Userform in one, and I click to select the second application, the Userform of the first application continues to show. While the Userform in one continues to be active, I cannot work or open the Userforms of the other. Has anyone ever experience this issue? How do I bypass it? Note: this does not seem to have anything to do with wether the Userform is Modal or Modaless |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Please post solutions only. Don't waste time telling me that I didn't explain
the problem the first time. Ed "Peter T" wrote: Difficult to know how Nick could have given any clearer information than he did on the basis of your OP, catered for scenarios you didn't previously clarify, including the one you have now. Again, let me state that this problem does not seem to have anything to do with whether the Userform is Modal. It has everything to do wither whether the forms are modal/modeless. With a modal form the only way you could activate another workbook or run a form in another workbook is via code in the form, say activated from a button. For your situation with two modeless forms try running same in two workbooks (pretty much along the lines already suggested) - 'normal module Public gbUF1 As Boolean Sub showFormModeless() UserForm1.Show vbModeless End Sub 'userform1 Private Sub UserForm_Initialize() Me.Caption = ThisWorkbook.Name ThisWorkbook.Activate gbUF1 = True End Sub Private Sub UserForm_Terminate() gbUF1 = False End Sub 'thisworkbook module Private Sub Workbook_Activate() If gbUF1 Then UserForm1.Show vbModeless End Sub Private Sub Workbook_Deactivate() If gbUF1 Then UserForm1.Hide End Sub Various other ways depending on what you are doing. Regards, Peter T "Edward" wrote in message ... Again, let me state that this problem does not seem to have anything to do with whether the Userform is Modal. Try this: 1 - create two Excel files, call them Model 1 and Model 2 2 - add an userform to each UserForm1 and UserForm2 3 - create a simple macro in each Project to open these userforms using the Show method 4 - set each userform to be Modaless 5 - having both workbooks Model 1 and Model 2 open, open UserForm1 6 - then open UserForm2 Both UserForm1 and UserForm2 should show on the screen regarless of which Workbook you are making the active one. I don't the want this behaviour. Other programs such Access don't behave like this. Does anyone know how to make Excel only show UserForm1 when Model 1 is the active workbook, and to only show UserForm2 when Model 2 is the active one. Ed "NickHK" wrote: Edward, Whilst you can have multiple workbooks open in the same instance of Excel, only one of them can be active at a time. Also only one thread of code can execute at a time. Depending what you are trying to achieve, you hide/show userforms in another's Activate/Deactivate event or in the same events for the worksheets. Obviously, if you are showing a userform vbModal (the default value), you cannot interact with other objects until you have hidden or unloaded that form. NickHK "Edward" wrote in message ... I need to run two Excel applications. Each has a different name and different content. The problem is that when I open a Userform in one, and I click to select the second application, the Userform of the first application continues to show. While the Userform in one continues to be active, I cannot work or open the Userforms of the other. Has anyone ever experience this issue? How do I bypass it? Note: this does not seem to have anything to do with wether the Userform is Modal or Modaless |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Should anyone else wish to address your issue, for their and your benefit,
you might explain why the descriptions given both by Nick and myself were not relevant re use of modal forms. Also explain why the *solution* I gave you to cater for - 4 - set each userform to be Modaless and only showing one form didn't work or why it cannot be adapted. Regards, Peter T "Edward" wrote in message ... Please post solutions only. Don't waste time telling me that I didn't explain the problem the first time. Ed "Peter T" wrote: Difficult to know how Nick could have given any clearer information than he did on the basis of your OP, catered for scenarios you didn't previously clarify, including the one you have now. Again, let me state that this problem does not seem to have anything to do with whether the Userform is Modal. It has everything to do wither whether the forms are modal/modeless. With a modal form the only way you could activate another workbook or run a form in another workbook is via code in the form, say activated from a button. For your situation with two modeless forms try running same in two workbooks (pretty much along the lines already suggested) - 'normal module Public gbUF1 As Boolean Sub showFormModeless() UserForm1.Show vbModeless End Sub 'userform1 Private Sub UserForm_Initialize() Me.Caption = ThisWorkbook.Name ThisWorkbook.Activate gbUF1 = True End Sub Private Sub UserForm_Terminate() gbUF1 = False End Sub 'thisworkbook module Private Sub Workbook_Activate() If gbUF1 Then UserForm1.Show vbModeless End Sub Private Sub Workbook_Deactivate() If gbUF1 Then UserForm1.Hide End Sub Various other ways depending on what you are doing. Regards, Peter T "Edward" wrote in message ... Again, let me state that this problem does not seem to have anything to do with whether the Userform is Modal. Try this: 1 - create two Excel files, call them Model 1 and Model 2 2 - add an userform to each UserForm1 and UserForm2 3 - create a simple macro in each Project to open these userforms using the Show method 4 - set each userform to be Modaless 5 - having both workbooks Model 1 and Model 2 open, open UserForm1 6 - then open UserForm2 Both UserForm1 and UserForm2 should show on the screen regarless of which Workbook you are making the active one. I don't the want this behaviour. Other programs such Access don't behave like this. Does anyone know how to make Excel only show UserForm1 when Model 1 is the active workbook, and to only show UserForm2 when Model 2 is the active one. Ed "NickHK" wrote: Edward, Whilst you can have multiple workbooks open in the same instance of Excel, only one of them can be active at a time. Also only one thread of code can execute at a time. Depending what you are trying to achieve, you hide/show userforms in another's Activate/Deactivate event or in the same events for the worksheets. Obviously, if you are showing a userform vbModal (the default value), you cannot interact with other objects until you have hidden or unloaded that form. NickHK "Edward" wrote in message ... I need to run two Excel applications. Each has a different name and different content. The problem is that when I open a Userform in one, and I click to select the second application, the Userform of the first application continues to show. While the Userform in one continues to be active, I cannot work or open the Userforms of the other. Has anyone ever experience this issue? How do I bypass it? Note: this does not seem to have anything to do with wether the Userform is Modal or Modaless |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Time Conversion issue | Excel Discussion (Misc queries) | |||
Time on the X Axis Issue | Charts and Charting in Excel | |||
Excel vb running a batch files and parsing output issue | Excel Programming | |||
Run Time Issue | Excel Programming | |||
How to become a better programmer, post college. More projects or less projects. | Excel Programming |