The information in this article applies to:
SUMMARYIn Microsoft Windows, you cannot resize a window if it is already maximized or minimized (for example, if the Microsoft Excel window is maximized or minimized, you cannot choose the Size command from the Control menu to change the size of the window).
MORE INFORMATIONMicrosoft provides examples of Visual Basic for Applications procedures for illustration only, without warranty either expressed or implied, including, but not limited to the implied warranties of merchantability and/or fitness for a particular purpose. The Visual Basic procedures in this article are provided 'as is' and Microsoft does not guarantee that they can be used in all situations. While Microsoft support professionals can help explain the functionality of a particular macro, they will not modify these examples to provide added functionality, nor will they help you construct macros to meet your specific needs. If you have limited programming experience, you may want to consult one of the Microsoft Solution Providers. Solution Providers offer a wide range of fee-based services, including creating custom macros. For more information about Microsoft Solution Providers, call Microsoft Customer Information Service at (800) 426-9400. Sample Visual Basic Code'The following two Declare statements must each be entered on a single 'line. Declare Sub movewindow Lib "USER" (ByVal hwnd%, ByVal x%, _ ByVal y%, ByVal nwidth%, ByVal nheight%, _ ByVal brepaint%) Declare Function GetActiveWindow% Lib "USER" () Sub WindowResize() ' If there's an error in the line that tries to activate file manager ' go to the line that would help start it. On Error GoTo startfilemgr 'Activate the file manager AppActivate "file manager" ' Get the window handle of the active application (File Manager ' in this example). hwnd = GetActiveWindow() 'End the error checking routine Exit Sub ' Resize the file manager or the active application and place it in ' the upper-left corner of your screen movewindow hwnd, 3, 3, 500, 500, 1 ' If there was an error starting File Manager use the following ' piece of the program. startfilemgr: 'Start File Manager shellid = Shell("c:\windows\winfile.exe", 1) 'Activate File Manager AppActivate shellid 'Get the Window Handle hwnd = GetActiveWindow 'Resize the Window Handle. movewindow hwnd, 3, 3, 500, 500, 1 End Sub
Additional query words: 5.00c Keywords : kbprg xlvbahowto |
Last Reviewed: October 14, 1999 |