Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Show a Excel UserForm in Access

Hi,

I am working on an application of which the front end is Access, the
backend is Excel. Basically all important parameter values are stored
in the Access, which calls Excel to do the modeling work. In the end
some of the results would be saved in the access.

As the modeling Macro takes some time, I implemented a progress bar in
excel to let people know the status of the job. I made one by following
the J-Walker's example. http://j-walk.com/ss/excel/tips/tip34.htm. It
runs greatly.

But I want to show the Userform(progress bar) When people working in
the Access. I don't want people to see the excel file, so in automation
I use the default,setting, which means the opened excel file is
invisible. But I can not see the progress bar either. Is there some way
to bring the excel user form to the front? I tried different ways, such
as set the visible property of the excel file at different places;The
results is not satisfactory. after doing some reseach, I think calling
some Win API may be helpful. I tried "SetForegroundWindow", and
"FindWindow", but it still does not work.

If Anyone has experieces in this, Can you give me some suggestions?

Thanks
mark li

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Show a Excel UserForm in Access


Hello Mark,

This code will keep your UserForm on top of all other forms. Add a VB
Module to your project and copy the code below into it.

CALLING THE MACRO
In the UserForm Activate event code module insert the following...
KeepFormOnTop


Code
-------------------

Private Declare Function SetWindowPos _
Lib "user32.dll" _
(ByVal hWnd As Long, _
ByVal hWndInsertAfter As Long, _
ByVal x As Long, _
ByVal y As Long, _
ByVal cx As Long, _
ByVal cy As Long, _
ByVal wFlags As Long) As Long

'Returns the Window Handle of the Active Window
Public Declare Function GetActiveWindow _
Lib "user32.dll" () As Long

Public Sub KeepFormOnTop()

Dim hWnd As Long

Const HWND_NOTOPMOST = -2
Const HWND_TOPMOST = -1
Const SWP_NOMOVE = &H2
Const SWP_NOSIZE = &H1

hWnd = GetActiveWindow()

SetWindowPos hWnd, HWND_TOPMOST, 0, 0, 0, 0, _
SWP_NOMOVE + SWP_NOSIZE

End Sub

-------------------


Sincerely,
Leith Ros

--
Leith Ros
-----------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...fo&userid=1846
View this thread: http://www.excelforum.com/showthread.php?threadid=49561

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Show a Excel UserForm in Access

Hi Leith,

Thanks very much for your help. That is exactly what I want to know.
Have a great holiday.

Mark

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
Userform access on multiple excel files?? kewlrunnings Excel Programming 1 October 8th 05 12:21 PM
why do word documents show up on excel and access file menu? LJH Excel Discussion (Misc queries) 1 February 26th 05 11:47 AM
Access from add_in userform to main template userform.... Ajit Excel Programming 1 November 18th 04 05:15 PM
VB UserForm to MS Access bsullins[_6_] Excel Programming 0 October 13th 04 11:20 PM
How to show a userform using excel macro in multipage Solomon B Excel Programming 1 April 27th 04 03:32 PM


All times are GMT +1. The time now is 12:33 AM.

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

About Us

"It's about Microsoft Excel"