Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6096849
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:58:30+00:00 2026-05-23T12:58:30+00:00

I need to create a userform for my excel vba program., But how can

  • 0

I need to create a userform for my excel vba program., But how can I add “minimize” button for this userform? Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T12:58:30+00:00Added an answer on May 23, 2026 at 12:58 pm

    You can try this code :

    Private Sub ToggleButton1_Click() 
        If ToggleButton1.Value = True Then
            Me.Height = Me.Height * 0.25
        Else
            Me.Height = dHeight
        End If
    End Sub
    
    Private Sub UserForm_Initialize()
        dHeight = Me.Height    
    End Sub
    

    [EDIT]
    Found this link where they explain how to do it with an API to minimize.

    Here is the given code :

    Option Explicit
    Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
    Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) 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 Declare Function DrawMenuBar Lib "user32" (ByVal hWnd As Long) As Long
    Private Declare Function ShowWindow Lib "user32" (ByVal hWnd As Long, ByVal nCmdShow As Long) As Long
    
    Private Const GWL_STYLE As Long = (-16) 'Sets a new window style
    Private Const WS_SYSMENU As Long = &H80000 'Windows style
    Private Const WS_MINIMIZEBOX As Long = &H20000
    Private Const WS_MAXIMIZEBOX As Long = &H10000
    Private Const SW_SHOWMAXIMIZED = 3
    
    Private Sub UserForm_Activate()
    Dim lFormHandle As Long, lStyle As Long
    '===========================================
    '= Originally from Dax =
    '= Modified with comments by Ivan F Moala =
    '= 22/07/01 =
    '===========================================
    
    'Lets find the UserForm Handle the function below retrieves the handle
    'to the top-level window whose class name ("ThunderDFrame" for Excel)
    'and window name (me.caption or UserformName caption) match the specified strings.
    lFormHandle = FindWindow("ThunderDFrame", Me.Caption)
    
    'The GetWindowLong function retrieves information about the specified window.
    'The function also retrieves the 32-bit (long) value at the specified offset
    'into the extra window memory of a window.
    lStyle = GetWindowLong(lFormHandle, GWL_STYLE)
    
    'lStyle is the New window style so lets set it up with the following
    lStyle = lStyle Or WS_SYSMENU 'SystemMenu
    lStyle = lStyle Or WS_MINIMIZEBOX 'With MinimizeBox
    lStyle = lStyle Or WS_MAXIMIZEBOX 'and MaximizeBox
    
    'Now lets set up our New window the SetWindowLong function changes
    'the attributes of the specified window , given as lFormHandle,
    'GWL_STYLE = New windows style, and our Newly defined style = lStyle
    SetWindowLong lFormHandle, GWL_STYLE, (lStyle)
    
    'Remove >'< if you want to show form Maximised
    'ShowWindow lFormHandle, SW_SHOWMAXIMIZED 'Shows Form Maximized
    
    'The DrawMenuBar function redraws the menu bar of the specified window.
    'We need this as we have changed the menu bar after Windows has created it.
    'All we need is the Handle.
    DrawMenuBar lFormHandle
    
    End Sub
    

    Regards,

    Max

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm programming VBA for Word 2007. I've created a UserForm which I need to
I need to create an XML schema that looks something like this: <xs:element name=wrapperElement>
I need to create a 2D int array of size 800x800. But doing so
I'm using Visual Studio 2008 and I need create a DataTable from a Excel
I need create menu for widget like this https://www.gstatic.com/android/market/com.bugabuga.switcher/ss-320-0-0 . What components are used?
Need to create some table so I can get an info from it in
I want add new user from another script and I need create password for
I need to create a program that will communicate with other programs on the
Maybe that's not exactly the solution i need, but this is what i want
I need create xls-file with own data. But file may already be created, and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.