We definitely spent a lot of time in Excel exploiting macros and Excel's l
ovable relationship with macros.
Say, if you notice, the entire time that we were working inside of Excel with
those macros, we never got a single warning.
And that's not always the case with the rest of the Microsoft Office Suite,
which is why in this challenge, we're going to be working with Microsoft Word.
But don't you worry, I'm going to give you a couple of tidbits before we
actually get into the actual challenge.
First things first, we need to go ahead and open up Word and get ready for the
macros and getting them integrated.
We're just going to open up a blank document.
And if you haven't already, go to file into the options on the lower left
because we have to enable it on our ribbon because it's not there about default
.
So you can go to the customized ribbon, just like we did earlier in Excel, and
just make sure that you have it over on a tab.
Or you can also check the developer box as well too.
I have it on the top right, you can see it up here next to the legacy tools.
And inside of macros, you'll see right here that we don't have anything
whatsoever.
Now, there are a couple of things you can do here. First and foremost, you can
export the macros from your Excel exercises and import them here, but they're
going to go in a different location.
So I'm just going to create one called test and go to create.
And on the left right here, you'll see that it's under that new macros. That's
fine. But right below that, where it says project is where we're going to be
going for this.
So if you expand inside a project and then expand the Microsoft Word objects, I
'm going to highlight it and then double click it.
You can see here that it has this document. Well, inside of here is where we're
going to actually be putting our macro at.
And the reason for this is is because the code that I have below this video is
the exact same thing that's for output wise that we got in the Excel.
There are some tweaks to it. For instance, I cleaned it up and I also made it
to where it's for document open. So anytime that this Word document is open,
this macro is going to run immediately right off the bat.
And you're going to put it inside of this document area and save it. Now, you
want you do that. We'll close this. You'll go to file, save as
And instead of saving it just as a regular Word document, you're going to have
to save it as a word. It macro enabled document.
The extension on this would be dot D O C M. The reason for this is is because
word is a little bit more finicky with those macros.
By default, in a word document, you can't have macros run automatically.
In fact, when you do add the macros, you're going to see a little warning up at
the top saying security features about your macros and you can go in there and
start adjusting the security
mechanisms left, right and center to be able to adjust how you see fit for your
word documents in the future.
And this plays into what we were talking about earlier in the skill where we
said macro requires its own level of security.
As those security technicians and administrators that we are, we know that
macros have the ability, especially in the skill by this point, to run a many
of different things. We're just using it for
going around with things like getting IP configs.
So when you save it as a word macro document and you put it on the desktop, you
'll see that I have one already there that we're going to be taking a look at in
the solution for this challenge.
Now, with all those tidbits out of the way, with the code below and everything
I just showed you, can you go ahead and have a create a word document that
whenever it opens, it creates the little pop up that says done.
Puts an output file on the desktop and sends it over to our Kelly box for
review on a separate system. I'll see you in the solution.