VBA Minimized Excel only shows the form, and the form is always in front of all programs

Updated on technology 2024-03-30
5 answers
  1. Anonymous users2024-02-07

    If you want to display the form at the top of Excel**, then use a modular way to open it at the statement of the display form, that is, add a 1 after the show

    For example: sub auto open().

    1end sub

    If it's 0 or not, the form isn't forced first.

    If you want to show only the form and the excel is hidden, you can set excel to be invisible and only show the form through the following statement

    private sub from_load()end sub

  2. Anonymous users2024-02-06

    Include the following in this work book**.

    private sub workbook_open()0

    end sub

    Then add to the main form you want to load.

    private sub userform_initialize() 'When the form is loaded, do the following.

    xlminimized 'Minimize the excel window.

    end sub

  3. Anonymous users2024-02-05

    There are 2 methods in all 3:

    1. Set the window to no title, and then customize the title mode to simulate the minimization function.

    2. Restore the minimization button of the window through the API.

    The second method is recommended here, which is relatively stable and simple to develop.

    **:option explicit

    private declare function getwindowlong lib "user32" alias "getwindowlonga" (byval hwnd as long, byval nindex as long) as long 'Get the window style API

    private declare function findwindow lib "user32" alias "findwindowa" (byval lpclassname as string, byval lpwindowname as string) as long 'Find the current window handle API

    private declare function setwindowlong lib "user32" alias "setwindowlonga" (byval hwnd as long, byval nindex as long, byval dwnewlong as long) as long

    private const gwl_style = (-16) 'Set window style API

    Minimize) initialization of the userform form.

    private sub userform_initialize()

    dim hwndform as long

    dim istyle as long

    hwndform = findwindow("thunderdframe", 'Get window handle.'

    istyle = getwindowlong(hwndform, gwl_style) 'Gets the current title block style.

    istyle = istyle or ws_minimizebox 'Set the minimization button.

    setwindowlong hwndform, gwl_style, istyle 'The minimize button is displayed.

    end sub

  4. Anonymous users2024-02-04

    ''Use the API to add Maximize and Minimize buttons to your form

    option explicit

    private declare function getwindowlong lib "user32" alias "getwindowlonga" (byval hwnd as long, byval nindex as long) as long

    private declare function findwindow lib "user32" alias "findwindowa" (byval lpclassname as string, byval lpwindowname as string) as long

    private declare function setwindowlong lib "user32" alias "setwindowlonga" (byval hwnd as long, byval nindex as long, byval dwnewlong as long) as long

    private const gwl_style = (-16)

    recovery size) minimized).

    maximize) private sub userform initialize().

    dim hwndform as long

    dim istyle as long

    hwndform = findwindow("thunderdframe",istyle = getwindowlong(hwndform, gwl_style)

    istyle = istyle or ws_thickframe 'Restore.

    istyle = istyle or ws_minimizebox 'Minimize.

    istyle = istyle or ws_maximizebox 'Maximize.

    setwindowlong hwndform, gwl_style, istyle

    end sub

  5. Anonymous users2024-02-03

    Click on the form you want to set up, and look for a minbutton or something in the properties, and it will be set to true

Related questions
4 answers2024-03-30

Sky Software Station) use specific steps:1Unzip the envelope first, and then open the tool and there is a plus sign on the interface! >>>More

3 answers2024-03-30

It's in the taskbar. Look at the time there.