|Publish Date : ৫/১৪/২০১৪||Editor : BDITNEWS||Total Reader : 1287|
Now we will create another macro. This macro will add a background shade to a line of text. Like this one below:
Except our macro won't add the text - it will just add the shade to any line we choose. And we're going to create this macro in the toolbar. We'll see how to add a button in any toolbar. When we want to shade a line of text, all we need to do is click the button. We don't have to open the Borders and Shading dialogue box.
So let's make a start.
1. Click Tools > Macro > Record New Macro
2. The Macro dialogue box appears
3. Type in a new name for your macro. Call it ShadeLine
4. Click the Toolbar icon
5. Another dialogue box appears:
This is where the fun starts! The idea now is drag your macro to a toolbar and drop it. Your macro is the one under "Commands". Ours says Normal.NewMacros.ShadeLine, and there's a little icon to the left if it. To drag it to a toolbar, do the following.
1. Click on your macro Normal.NewMacros.ShadeLine with your left mouse button
2. Keep your left mouse button held down
3. Drag your mouse upwards
Keep your eyes on the mouse pointer. As soon as you start dragging it will look like the one below:
Notice the mouse pointer, circled in red above. This is what it looks like when you hold down your left mouse button and start dragging. Pay particular attention to the black X just below the white arrow. The black X means that you can't drop your macro in that position.
In the next picture, the mouse button is held down and the macro is being dragged to the toolbar area:
The macro is now on a grey area of the toolbar. Notice that the black X is still there. So we can't drop our macro here, either. The left mouse button is still being held down, by the way.
In this next picture the macro is now being dragged onto a toolbar itself:
The thing to notice now is the black X below the white mouse pointer is no longer there. We now have a plus + sign. There is also a black I bar. What all this means is that you can now let go of the left mouse button. You have found a place where it is possible to drag your macro - on a toolbar.
When you let go of your mouse, your toolbar will look like this:
That's your macro right there! Or rather, it is the button for your macro. When this button is clicked, it will run your macro. (We haven't created the macro itself yet. We're just setting up the toolbar button for it.)
The button looks a bit big and messy. We can format it.
1. Click on your new button with your Right mouse button
2. A menu appears
3. Move your mouse down to Change Button Image
4. A sub menu appears with lots of little pictures on it. Like the one below:
5. Click on any of the pictures with you left mouse button
6· The menu closes and the picture appears on your button
7· Your toolbar button will also have some rather long text on it.
We don't need all that Normal.NewMacro.ShadeLine on it, though. Let's get rid of some it:
1. Again, click on your button with your Right mouse button
2. The menu pops up again
3. Click inside the text box next to Name
4. Delete all the text in the text box, except for the word ShadeLine. (You delete the text in a text box by hitting the Backspace key on your keyboard.)
5. Your button should now look like the one below:
That's much nicer. We can now start to record the macro for the button. So click the Close button on the Customize dialogue box.
You are returned to your Word document, and the little recorder will be on the page. Record the macro by doing the following.
1. Click on Format from the menu bar
2. From the drop down menu, click on Borders and Shading
3. The Borders and Shading dialogue box appears
4. Click the Shading tab strip
5. Click a coloured square for your Shading (We picked one of the grey squares.)
6. Click the OK button at the bottom to close the dialogue box
7. Click the recorder's Stop Recording button
8. You macro is recorded. Time to test it out.
You will have a shaded line going across the page. Move your cursor down a few lines. If the shade moves with your cursor, get rid of the shading by clicking on Format > Borders and Shading. Select the Shading tab strip again, and click on No fill at top of the colour squares. Click the OK button.
1. So to test out your new macro, position your cursor at the start of a new line
2. Click your new ShadeLine button
And that it is how to add a macro to the toolbar. If you got this far, and added a button to the toolbar, then very well done indeed! You're becoming something of a Word expert, because this is quite advanced Word Processing.