Condividi tramite


Novice Challenge 4: I Need a New Style

Office Programs Required

Microsoft Word 2007

Goldfish Awarded

10

Deadline for Submission

Friday, April 24, 2009 (8:00 AM Pacific Daylight Time)

Files Required

NoviceChallenge04.docm in the OfficePalooza Challenge Pack.

Before beginning this challenge, feel free to take a break and read the contents of NoviceChallenge04.docm, which just happens to contain the first chapter of Pride and Prejudice, by Jane Austen. You don’t have to read it, but you can if you want.

What you do have to do, if you want to successfully complete this challenge, is change the style of this document. Sounds easy, right? Well, we’ve thrown in a little bit of a twist to make it interesting. (What would a challenge be without a little bit of a challenge?)

The document contains a combination of font styles. What you need to do is change all the font styles to one style. But not just any style. You must change the style to a font on your computer with a name that begins with the letter B.

But not just any font that begins with B – we don’t want you to just pick a font name and change all the text in the document to that font. What you need to do is use the FontNames object (which you can learn about in the Microsoft Office SDK) to return the first font it finds with a name that begins with the letter B. The first font in that object collection beginning with the letter B is the one you want. Once you find that font, change the style of all text in the document to that font.

Note that the first font name beginning with B on your computer may not be the same as the first font on the test computers that will be verifying your code. That’s okay. Just make sure you get the first font name that starts with B and you’ll be okay.

When you open the Visual Basic editor (which you can do by pressing Alt+F11), there should already be a window open with the subroutine ChangeStyleToB showing. Insert your code into this subroutine. (If you don’t see this subroutine, double-click on Module1 in the Project pane on the left under VBAProject (NoviceChallenge04).) Do not create any other subroutines – all your code should go in here.

Important: Do not add code to save the document.

Submitting Your Entry

The OfficePalooza sweepstakes is over, but you’re welcome to try the challenges and learn on your own. Good luck!