![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
Using a fresh install OL 2003 SP2, Win 2000 Pro SP2, E2K 2000 profile. All Com addins
removed. I created a UserForm and macro that shows it when its run. ~~~~~~~~~~~~~~~~~~~~~~~~~~~ Private Sub ShowForm() UserForm1.Show End Sub ~~~~~~~~~~~~~~~~~~~~~~~~~~~ The ShowModal property of the form is set to True. When I test it from within the VBE the macro runs, the form shows and deactivates Outlook till the form is closed. This I believe is absolutely normal. I save and close the project and run the macro from within Outlook. The UserForm shows but the parent application is not fully deactivated. The explorer in Outlook is fully active. I can open and close emails, browse folders and when the close X button on the top right of Outlook is clicked it closes the form. The only things that were deactivated were the menu bar and buttons. I deleted the profile and set it up again this time without the E2K settings but setup for Personal Folders. I ran the ShowForm macro again and believe it or not, the form showed up in full modal fashion. The Outlook application was deactivated behind the form. Success!..... I added E2K to the profile. It still worked! I deleted this that profile and again created a new E2K only based profile. This time, when I ran the macro, the form showed up again in "Semi-Modal" fashion. It seems that making the connection to Exchange is causing the problem. I have been able to replicate this sort of behaviour on different machines with different builds using Outlook XP or OL2003. So I guess, here are my questions. Has anyone seen this behaviour before? Is there any work around for this? I've tried 'UserForm1.Show vbModal'. That dosn't work. Is it possible to set the parent of the form? Can I somehow respecify the scope of the forms modality? ie to include the Outlook Explorer. It seems like the Outlook Explorer dosn't even know the UserForm is there when E2K is connected. Thanks in advance. Dave |
Ads |
#2
|
|||
|
|||
![]()
Looks like it's a bit of a bug in MSForms 2.0.
Instead I used Win API to get the handle of the form an set to the front, which as a matter of fact makes it modal. Private Declare Function SetForegroundWindow Lib "user32" (ByVal hWnd As Long) As Long Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _ (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Private Sub UserForm_Initialize() Dim hWnd As Long hWnd = FindWindow("ThunderDFrame", Me.Caption) SetForegroundWindow hWnd End Sub "David OShea" wrote in message ... Using a fresh install OL 2003 SP2, Win 2000 Pro SP2, E2K 2000 profile. All Com addins removed. I created a UserForm and macro that shows it when its run. ~~~~~~~~~~~~~~~~~~~~~~~~~~~ Private Sub ShowForm() UserForm1.Show End Sub ~~~~~~~~~~~~~~~~~~~~~~~~~~~ The ShowModal property of the form is set to True. When I test it from within the VBE the macro runs, the form shows and deactivates Outlook till the form is closed. This I believe is absolutely normal. I save and close the project and run the macro from within Outlook. The UserForm shows but the parent application is not fully deactivated. The explorer in Outlook is fully active. I can open and close emails, browse folders and when the close X button on the top right of Outlook is clicked it closes the form. The only things that were deactivated were the menu bar and buttons. I deleted the profile and set it up again this time without the E2K settings but setup for Personal Folders. I ran the ShowForm macro again and believe it or not, the form showed up in full modal fashion. The Outlook application was deactivated behind the form. Success!..... I added E2K to the profile. It still worked! I deleted this that profile and again created a new E2K only based profile. This time, when I ran the macro, the form showed up again in "Semi-Modal" fashion. It seems that making the connection to Exchange is causing the problem. I have been able to replicate this sort of behaviour on different machines with different builds using Outlook XP or OL2003. So I guess, here are my questions. Has anyone seen this behaviour before? Is there any work around for this? I've tried 'UserForm1.Show vbModal'. That dosn't work. Is it possible to set the parent of the form? Can I somehow respecify the scope of the forms modality? ie to include the Outlook Explorer. It seems like the Outlook Explorer dosn't even know the UserForm is there when E2K is connected. Thanks in advance. Dave |
#3
|
|||
|
|||
![]()
Your form must be created as a child of the Outlook Explorer, this really
has nothing todo with Exchange. On the low level, CreateWindow() Windows API function must take the Explorer's handle, which can be retrieved by QI'ing the Explorer for IOleWindow. Thta's being said, I don't know how/if VB allows to override its default behavior when creating its forms. Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool "David OShea" wrote in message ... Using a fresh install OL 2003 SP2, Win 2000 Pro SP2, E2K 2000 profile. All Com addins removed. I created a UserForm and macro that shows it when its run. ~~~~~~~~~~~~~~~~~~~~~~~~~~~ Private Sub ShowForm() UserForm1.Show End Sub ~~~~~~~~~~~~~~~~~~~~~~~~~~~ The ShowModal property of the form is set to True. When I test it from within the VBE the macro runs, the form shows and deactivates Outlook till the form is closed. This I believe is absolutely normal. I save and close the project and run the macro from within Outlook. The UserForm shows but the parent application is not fully deactivated. The explorer in Outlook is fully active. I can open and close emails, browse folders and when the close X button on the top right of Outlook is clicked it closes the form. The only things that were deactivated were the menu bar and buttons. I deleted the profile and set it up again this time without the E2K settings but setup for Personal Folders. I ran the ShowForm macro again and believe it or not, the form showed up in full modal fashion. The Outlook application was deactivated behind the form. Success!..... I added E2K to the profile. It still worked! I deleted this that profile and again created a new E2K only based profile. This time, when I ran the macro, the form showed up again in "Semi-Modal" fashion. It seems that making the connection to Exchange is causing the problem. I have been able to replicate this sort of behaviour on different machines with different builds using Outlook XP or OL2003. So I guess, here are my questions. Has anyone seen this behaviour before? Is there any work around for this? I've tried 'UserForm1.Show vbModal'. That dosn't work. Is it possible to set the parent of the form? Can I somehow respecify the scope of the forms modality? ie to include the Outlook Explorer. It seems like the Outlook Explorer dosn't even know the UserForm is there when E2K is connected. Thanks in advance. Dave |
#4
|
|||
|
|||
![]()
Thanks Dmitry for your reply.
I used this and it works very well. Cheers Dave Private Declare Function SetForegroundWindow Lib "user32" (ByVal hWnd As Long) As Long Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _ (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Private Sub UserForm_Initialize() Dim hWnd As Long hWnd = FindWindow("ThunderDFrame", Me.Caption) SetForegroundWindow hWnd End Sub "Dmitry Streblechenko" wrote in message ... Your form must be created as a child of the Outlook Explorer, this really has nothing todo with Exchange. On the low level, CreateWindow() Windows API function must take the Explorer's handle, which can be retrieved by QI'ing the Explorer for IOleWindow. Thta's being said, I don't know how/if VB allows to override its default behavior when creating its forms. Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool "David OShea" wrote in message ... Using a fresh install OL 2003 SP2, Win 2000 Pro SP2, E2K 2000 profile. All Com addins removed. I created a UserForm and macro that shows it when its run. ~~~~~~~~~~~~~~~~~~~~~~~~~~~ Private Sub ShowForm() UserForm1.Show End Sub ~~~~~~~~~~~~~~~~~~~~~~~~~~~ The ShowModal property of the form is set to True. When I test it from within the VBE the macro runs, the form shows and deactivates Outlook till the form is closed. This I believe is absolutely normal. I save and close the project and run the macro from within Outlook. The UserForm shows but the parent application is not fully deactivated. The explorer in Outlook is fully active. I can open and close emails, browse folders and when the close X button on the top right of Outlook is clicked it closes the form. The only things that were deactivated were the menu bar and buttons. I deleted the profile and set it up again this time without the E2K settings but setup for Personal Folders. I ran the ShowForm macro again and believe it or not, the form showed up in full modal fashion. The Outlook application was deactivated behind the form. Success!..... I added E2K to the profile. It still worked! I deleted this that profile and again created a new E2K only based profile. This time, when I ran the macro, the form showed up again in "Semi-Modal" fashion. It seems that making the connection to Exchange is causing the problem. I have been able to replicate this sort of behaviour on different machines with different builds using Outlook XP or OL2003. So I guess, here are my questions. Has anyone seen this behaviour before? Is there any work around for this? I've tried 'UserForm1.Show vbModal'. That dosn't work. Is it possible to set the parent of the form? Can I somehow respecify the scope of the forms modality? ie to include the Outlook Explorer. It seems like the Outlook Explorer dosn't even know the UserForm is there when E2K is connected. Thanks in advance. Dave |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
UserForm ShowModal strange behaviour | David OShea | Outlook - Using Forms | 1 | March 14th 06 06:58 PM |