Results 1 to 3 of 3
  1. #1
    New Lounger
    Join Date
    Feb 2011
    Location
    Redford MI 48240
    Posts
    3
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Lightbulb Windows docking: Visual Basic

    I'm having a geeky moment here. I would like to know if there is a way to code the Dock Right and Dock Left functions in Windows 7 & 8.

    Every night at work I open two Excel Spreadsheets. I'm using Excel 2013 with the single doc interface.

    I open the first workbook press Windows + Left Arrow to dock it to the left side, then I dock the second workbook to the left.

    I would love to find a way to work this down to a single action. I have Visual Studio 2021 and of course access to VBA. The first workbook is company data that is passed around so it cannot have any code attached to it. The second is for my personal use. I've already added a few macros to it to help with some of the timekeeping functions on the first. I'm using my personal machine to do the work so I have room to play there.

    I've been out of practice with VB so my familiarity with the interface is a bit dated.

    Really a few hints on how I can discover for myself would be the best!

    Thanks
    Ted

  2. #2
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    6,409
    Thanks
    208
    Thanked 834 Times in 767 Posts
    Ted,

    See this MS Article on the SDI vs MDI interface. If you scroll down to the section on VBA you might find what you are looking for. HTH
    May the Forces of good computing be with you!

    RG

    VBA Rules!

    My Systems: Desktop Specs
    Laptop Specs


  3. #3
    Star Lounger
    Join Date
    Mar 2010
    Location
    Winston-Salem, NC USA
    Posts
    52
    Thanks
    11
    Thanked 3 Times in 3 Posts
    In Visual Studio, a form itself does not have "exposed" docking properties... but you can make a form look like a control and have a parent form contain the controls. The good news is, controls are dockable.

    Here's a sample that I'm using in a project using one form as a control and I'm docking it in the parent form. You can create multiple forms and set the docking properties as you like. You may want to use a combination of docking and anchoring to achieve the thing you're talking about.

    Private Sub InitOverview()

    Dim Overview As New frmDock

    With Overview
    .TopLevel = False
    .FormBorderStyle = Windows.Forms.FormBorderStyle.None
    .Visible = True
    .Dock = DockStyle.Fill
    End With

    Me.Controls.Add(Overview)

    End Sub
    Last edited by Bender; 2013-11-21 at 08:06. Reason: small correction
    Do your part!!! Report SPAM to http://www.spamcop.net/

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •