Video instructions and help with filling out and completing Form 2220 Browse

Instructions and Help about Form 2220 Browse

Hello everybody in this video I'm gonna be using Microsoft Excel 2010 I was asked a question by one of my viewers and that question is when using a VBA user form that has a command button how can you use that button to open up a new user form with a web browser now we're not going to be using the create object Internet Explorer that application method instead we're going to be using the web browser control that is built into Microsoft Excel so to get started we're gonna go to go to our developer tab and of course you know be in a new workbook but since we haven't already set we're gonna go to our Visual Basic environment I'm gonna go to use this drop down to insert a user form so we have our blank user form just I'm just going to click the user form and to our left we have our properties this is the default location if you don't see it go to view and select properties window I'm gonna go to my caption and we're going to change this to just main you can name it whatever you'd like in this case I'm gonna name mine main and for our tool box I'm going to go to tools I'm gonna hit additional controls I'm gonna scroll down until I have Microsoft web browser checkmark in this case mines already checked marked but more than likely on your application if you have it's at the sub already and that icons not going to be there by going into tech mark Microsoft web browser or in this case so select it go ahead and hit OK this icon with the earth should show up in this case that's our web browser icon I'm gonna go ahead and draw that onto our user forum and one thing I'm going to do is change a property on my user forum with my user forum still selected the property I'm going to change is show modal by default this value is true when this default when this value is set to true what's going on I'm going to execute this application real quick you'll see that I'm not able to click the workbook and that can be pretty annoying it's the same thing when if I was to open up a user forum another one this user forum would be disabled and the active one that opened up would be the one that we click and we don't we want all user forms to be accessible including the work the workbook so we're gonna set that value to false when it's set to false we can click the workbook as well as other user forms so going back to our visual basic environment I'm gonna go ahead and open up the user form I'm gonna put a command button on it I'm just gonna change the caption to go and we'll go ahead and add a text box as well this is where we'll type in the web browser URL in this case I'm just gonna put for a default value Google and that's textbox one text well I'm sorry the name textbox 1 but when we write out the macro it's gonna be textbox one text so be a web browser one which if we go back to the user form we'll see this is the name of the web browser web browser one that navigate we want to go to text box one dot X and if we just play this hit go the page that we have it written right here will open but let's just say you need to what you need or want to have that loaded up into another user forum which is the question that I was asked then what we need to do is create a new user forum we'll call it use first off select drop-down menu insert user form this form is used to form two by default that's the name you can change it if you'd like well we're gonna put another web browser here and again we want to change that default value to false you can add a command button if you'd like in this case I'm just gonna right close and under close I'm just going to put user form to dot hide and so let's go ahead and do this on user form one we're going to create another command button we're gonna say load second fourth and all I'm pretty much gonna do is copy our code from web browser one that navigate but I'm gonna get it from user form - I'm gonna change it from user form one to use a form - I'm gonna go to open up user form - if we look at user form - and we select the web browser control we can see that the name is still the same web browser one however it's now on user form - so going back to our main user form we're gonna double click the load second form button here we're going to type in user form - dot web browser one dot navigate and this is where we'll put text box 1 dot Tex that way if this doesn't get too confusing you can always type in your user form 1 dot text box 1 dot text that we you know exactly what you're referencing once you do that navigate you want to show the user form user form two dots show now let's go ahead and try this out I'm going to activate the main user form and I'm gonna hit the play button or f5 and I'm going to put load second form once we do that we see that the page is navigating and user form two shows up the close button if we click the close button it should hide user form too now I'm gonna go and