Home |
Search |
Today's Posts |
#13
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello AG,
Yes the workbook would remain Excel 2003 format, and it will works fine in Excel 2007. Also it is possible to make the User Form always be visible and we'll be able to set focus to it, the detailed solution is shows as below: To make User Form visible at Workbook open we could take use of Workbook Open event: Private Sub Workbook_Open() UserForm1.Show vbModeless End Sub To set focus we have two options: 1st. The simple way. We could write a macro as below and assign a shortcut to the macro. Sub Setfocus() UserForm1.Hide UserForm1.Show vbModeless End Sub 2nd.This method will need some Windows APIs to achieve the same. First we need to insert a new class in the VB Editor and paste the following code into the class. Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Private Declare Function SetForegroundWindow Lib "user32" (ByVal hwnd As Long) As Long Public Sub ActivateUserForm() SetForegroundWindow DialogHWnd(UserForm1) End Sub Public Function DialogHWnd(ByRef WindowObject As Object) As Long DialogHWnd = GetWindowFromTitle(WindowObject.Caption, "ThunderDFrame") End Function Public Function GetWindowFromTitle(ByVal WindowTitle As String, Optional ByVal ClassName As String) As Long hwnd = FindWindow(ClassName, WindowTitle) GetWindowFromTitle = hwnd End Function Then we write a macro and assign a shortcut, the same as the first method: Sub activewindow() Dim k As New Class1 k.ActivateUserForm End Sub Best regards, Tim Li Microsoft Online Community Support Delighting our customers is our #1 priority. We welcome your comments and suggestions about how we can improve the support we provide to you. Please feel free to let my manager know what you think of the level of service provided. You can send feedback directly to my manager at: . |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Hide ribbon+command bars in 2003/2007 for specific file | Excel Programming | |||
Open Workbook Add In with 2007 & 2003, Which Changes Ribbon & Tool | Excel Programming | |||
Hide Excel Ribbon 2007 | Excel Programming | |||
[Office 2007] Auto-hide ribbon toggle button and control recent do | Excel Programming | |||
Hide ribbon or menu bar in Excel 2007 | Excel Programming |