How to freely click between to open forms. VBA

how to open userform in excel automatically
excel vba click cell open form
vba call userform from module
vba open form excel
open form vba
double click cell to open userform
excel vba form controls
excel data entry form vba

I've been searching for a bit but not seeming to be hitting the right keywords.

What I am hoping to achieve is to have 2 separate user forms visible side by side. Both forms will have their own functionality and purpose but are meant to be used in conjunction with each other at times (hence the side by side). I would like to be able to click back and forth between the two forms freely, preferably with just a mouse click, like one would with their open applications on their desktop or OS.

I can't seem to even find ways or methods to make make the unfocused form active.

I am not a super strong programmer but I wouldn't consider myself a noob, but there are still a lot of syntax I've been seeing that looks greek to me and don't understand.

working on Microsoft Office Excel for Mac 2011

Thanks for any help guys and gals.

Cheers

VBA Userforms have the property "ShowModal" setting this to False will allow the form to be selected or deselected at will, as well as multiple forms to be shown and used simultaneously (as long as they are all modeless)

This can also be accomplished in code in the show event using

Userform1.Show vbModeless

you could then use the initialize event of one form to show the second form.

Private Sub UserForm_Initialize()
     UserForm2.Show vbModeless
End Sub

How to Launch an Excel VBA User Form, Launch a Form from a Button on a Spreadsheet. Go back to your When you click OK, you should see a coding window appear. To launch a form, you need the  How To Open A Form Using VBA In Access In this tutorial you will learn about: DoCmd Object and its methods, Close and OpenForm Clicked Event of a Button My U Skip navigation Sign in

Thanks everyone for your posts and feedback. I had been pulled away from the project for the last while, and since then have changed up the concept of it... also I may be abandoning it, but I will play around with some of the stuff you guys had advised and see what I can learn from it.

Thanks again.

How to click or double click cell to open a specified user form in Excel?, Click or double click a cell to open a specified user form with VBA code Free Download. More than 20 text features: Extract Number from Text String; Extract or Remove Part of Texts; Convert Numbers and Currencies to English Words. Remarks. You can use the OpenForm method to open a form in Form view, form Design view, Print Preview, or Datasheet view. You can select data entry and window modes for the form and restrict the records that the form displays. The maximum length of the WhereCondition argument is 32,768 characters

What you need is a modeless dialog box. See: how to display modal and modeless dialog boxes

Modal Dialog Box

A modal dialog box is a dialog box that takes all user input of the application. While this dialog box is open, the other forms of the application won't respond to user input. This is the most used form of dialog boxes. Example: the save file dialog box. While this dialog box is open, you can't edit your document. You'll first have to close the dialog box before you can continue changing the document. You can see this in Notepad when you save the file. While the save file dialog box is open you can't do anything with the main form

A modal dialog box is usually shown as follows:

private void onButton1_Clicked(object sender, ...)
{
    using(var dlg = new MyModalDialog())
    {
        dlg.PropertyA = ...;  // set some properties of the dialog
        dlg.PropertyB = ...;
        var dlgResult = dlg.ShowDialog(this); // show the dialog. I am the parent

        // this procedure is blocked until the dialog is closed.
        // if here: result is available:
        switch (dlgResult)
        {
            case DialogResult.OK:
                ProcessResult(dlg.GetResult());
                break;
            case DialogResult.Cancel:
                ProcessCancel();
                break;
            default:
                 ...
        }
    }
}
Modeless Dialog Box

You want a modeless dialog box: after showing one form, you want to continue in your code to be able to show the other form. For this you don't use Form.ShowDialog but Form.Show

private MyForm1 formA = null;
private MyForm2 formB = null;
private void onButton1_Clicked(object sender, ...)
{
    this.formA = new MyForm1())
    this.formA.PropertyA = ...;

    this.formB = new MyForm2())
    this.formB.PropertyA = ...;

    // make sure the forms are shown side by side
    this.formA.Position = ...
    this.formA.Size = ...
    this.formB.Position = ...
    this.formB.Size = ...

    // show the forms:
    this.formA.Show(this);
    this.formB.Show(this);

    // while the form are shown, your main form can continue
    ...
}

You'll have to subscribe to the Form.Closed event before you show the forms, so you can take actions, like Disposing the forms.

this.FormA.Closing += new System.EventHandler(this.OnSubFormClosed);
this.FormA.Show(this);

In OnSubFormClosed you should check the 'Sender` to inspect which form is closed and act accordingly:

void OnSunFormClosed(object sender, EventArgs e)
{
    if (Object.ReferenceEquals(sender, this.formA)
    {   // FormA closed:
        this.ProcessFormAClosed();
        this.FormA.Dispose();
        this.FormA = null;
    }
    else if (Object.ReferenceEquals(sender, this.FormB)
    {
        ...
    }
}

Finally: you should inform your forms when your main form is being closed. If you do this in Form.OnClosing instead of Form.OnClosed you can ask your forms whether they are ok with it to being closed. For example, the form may ask the operator to save the file and give the opportunity to anser yes / no / cancel. In the latter case the application should not be closed. Check this behaviour if you try to close Notepad with unsaved edits.

protected override void OnFormClosing(cancelEventArgs e)
{
     // the following may be optimized
     bool closeFormAallowed = this.formA?.IsClosingAllowed ?? true;
     bool closeFormBallowed = this.formB?.IsClosingAllowed ?? true;

     // cancel closing if closing is not allowed
     e.Cancel = !closeFormAallowed || !closeFormBallowed;

     // don't forget to raise the event so my subscribers my decide to cancel closing:
     if (!e.cancel) base.OnClosing(e);

     // if no one wants to cancel closing: close the forms:
     if (!e.Cancel)
     {
         if (this.formA != null) this.formA.Close();
         it (this.formB != null) this.formB.Close();
         // this will raise the events, so the forms are properly disposed
     }
}

Click or Double Click Cell to Show userform, How to open a user form just by clicking or double click on a cell. Excel Macro VBA code to show a specified user form while clicking a cell or  Go back to your spreadsheet and add a new button. When the Assign Macro dialogue box appears, select Button1_Click: When you click OK, you should see a coding window appear. To launch a form, you need the Show method after the name of your form: Sub Button1_Click( ) UserForm1.Show. End Sub. Add the line to your own Button1_Click Sub.

Close/Open Userforms on Mouse Click - Excel General, Is there any VBA code that anyone knows that when a user clicks on the Add three buttons from the control toolbox to the worksheet. Click this to see the selection and insertion of the appropriate DoCmd.OpenForm with arguments and the form name using the Code VBA add-in. If you leave the DataMode argument blank the default constant, acFormPropertySettings, is assumed. This opens the form in the data mode set by the form's AllowEdits, AllowDeletions, AllowAdditions and

Open a Userform next to mouse cursor - Excel General, Hello, Im setting up some buttons that open a UserForm, is there any way of AFAIK positioning forms relative to a cell address is really tough and a menu structure when clicking a button, it would open the list next to the button. the mouse coordinates from somewhere to replicate this, any help again  Excel VBA - Learn how to call UserForm from button on spreadsheet The code used in this video: Private Sub CommandButton1_Click() UserForm1.Show End Sub.

VBA Open or Close UserForm, Notice in the example above we added “Unload.Me” to the “Click” event of the Cancel button. So when the user clicks the Cancel button, the form will unload. Open two Access forms at once by Mary Richardson in Software on March 13, 2007, 12:00 AM PST Opening two Access forms at once may be difficult, but it does not need to be.

Comments
  • Maybe you can post what you tried by far?
  • This is a very broad question and it would help to see what you have done so far. Is the code for each form on a separate workbook or are they both on the same? If they are on the same, you might want to consider integrating both into one form with separate pages or tabs instead of having two forms. If you insist on two forms on the same workbook however, you should start by looking at the initialize events for each form and determine whether you want the second form to be launched from the first while the first is active, or what other event is suitable depending on what you are looking for.
  • I understand that it was kind of a broad question, and I understand there are many ways to skin a cat, but i was kind of thinking that what I was coding on the two forms wouldn't necessarily matter on having forms unlock-able. At that time it was in concept mode and I hadn't started coding anything to be able to show you.
  • And Since I posted till now, I did end up changing the concept around to where having them on one form makes more sense, but I've also been pulled away from the project for awhile and possibly may be abandoning it. Thanks for posting tho.
  • I had like the looks for this simple coding, however I tried and it didn't work.
  • I googled around a little, turns out microsoft for mac doesn't support the mode. Lame
  • Your code examples use C#, not Excel VBA which OP wants
  • Oops! Still I hope KyeBosh understands the code and can translate it to his language. This answer might be useful for a C# user has the same question