Hi
I have written a VBA code in AutoCAD to export information to excel,
Is there a way I can keep userforms on top of all application windows (i.e Always show)
Hope someone can help
Streng
Hi
I have written a VBA code in AutoCAD to export information to excel,
Is there a way I can keep userforms on top of all application windows (i.e Always show)
Hope someone can help
Streng
I am thinking that Windows API is the way forward - Any Suggestions ?
Hello Streng,
Copy this code into a Standard VBA module. Place the macro KeepFormOnTop in the UserForm's Activate event module.
Example![]()
Please Login or Register to view this content.
![]()
Please Login or Register to view this content.
Last edited by Leith Ross; 05-19-2009 at 01:48 PM.
Sincerely,
Leith Ross
Remember To Do the Following....
1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.2. Thank those who have helped you by clicking the Starbelow the post.
3. Please mark your post [SOLVED] if it has been answered satisfactorily.
Old Scottish Proverb...
Luathaid gu deanamh maille! (Rushing causes delays!)
Thanks but still having trouble that the userform is still attached to AutoCAD, when I click on the userform it brings CAD to the top.
Will have to rethink my code.
Thanks Leith, this is the first code that I have been able to get to work for me (64 bit machine).
I had to modify it as follows:
Replace the 2 lines beginning "Const..." with the following lines:
![]()
Please Login or Register to view this content.
I have found a way to make my forms come to the top when I load them, and still behave “normally”. I have tried to do this a number of times in the past with different API functions, but always had negative/mixed results. This works well for me but it may or may not work for you – you will have to test it and see:
(1) At the top of a normal module (I think a form module is OK too):
I think Private can be changed to Public if it is to be called from different modules.![]()
Please Login or Register to view this content.
(2) I use Form1.Show but you may use a different command to display your form. Then to make it on top:
![]()
Please Login or Register to view this content.
(3) Dimension the handle as public
![]()
Please Login or Register to view this content.
(4) To get the handle, I use this code in the Initialize sub for the Form1 module:
![]()
Please Login or Register to view this content.
Only minor but, I have never been able to SetFocus to the form so as to highlight it. If anyone has worked out how to do that …..
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks