Solved

Assign a macro to a button in a Word document

Posted on 2007-11-28
8
2,085 Views
Last Modified: 2012-05-05
I'm making a form in Word 2007. It's like a student CV. I have a macro that creates a new table if a student wishes to add more than one qualification. I can't find a way to put a button on the page for the students to click, so as to activate the macro to create the new table.
0
Comment
Question by:nz_witch
  • 4
  • 4
8 Comments
 
LVL 17

Accepted Solution

by:
wobbled earned 125 total points
ID: 20372446
Use the insert field option and make that field a macrobutton.  You can select the macro you want from the list
0
 

Author Comment

by:nz_witch
ID: 20372488
Oh d'oh! I remember doing that ages ago in an old version of Word. I thought you could attach a macro to a button/auto shape, but I think I'm getting confused with Excel.

One thing I did discover today was the new Quick Part boilerplate gallery, which is going to make it so much easier to make a macro to create a table etc.

Do you mean the fields you can enter from the developer ribbon? I've been using the rich text one for students to click and enter their data - I'm not sure how to make those into a macrobutton. Will try tomorrow at work and get back to you.
0
 
LVL 17

Expert Comment

by:wobbled
ID: 20372519
Hi nz_witch, Excel is much easier with its buttons to assign a macro, but for a basic how to guide on inserting fields in office 2007 try this  http://www.uwec.edu/help/Word07/fields.htm

0
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 

Author Comment

by:nz_witch
ID: 20376926
OK, I added a field, 'Author', changed the text, how do I attach my pre-made macro to it?
0
 

Author Comment

by:nz_witch
ID: 20376974
Sorry, I see macrobutton is an entity on its own. I have attached my macro but the macrobutton disappears after it's clicked. I'll keep fiddling but I think it's nearly there. :)
0
 
LVL 17

Expert Comment

by:wobbled
ID: 20377125
Hi,

It shouldn't disappear after you click on it.

What you can do in Word 2007 is go to the developer tab, choose legacy controls.  Under there you will see a button object.  You can draw a button on your page.  Right click on the button and go to view code.  In here you can then just type call mymacro  where mymacro is the name of your macro.

Hope that helps
0
 

Author Comment

by:nz_witch
ID: 20377294
Thanks, I did get the macrobutton field going. It disappeared because I had my spacing up the wop and the table was placed over where the button was. :D That's sorted now.

I might go and try the legacy button, I looked at that yesterday but I wasn't sure how to run a macro from VB. As long as I can make it hidden so the student doesn't see it when it previews or prints.

Anyway, I know how to do it now, thanks to you, the rest is just fiddling to get it right.

Thanks for your help.
0
 
LVL 17

Expert Comment

by:wobbled
ID: 20380642
Not a problem, glad I could have helped and thanks for the points and grade
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When creating Microsoft Word-based forms there may be a need to have a form field repeated throughout the whole document. For instance, with a company name, you may want this information repeated automatically throughout the document rather than man…
I would like to show you some basics you can do with Mailings in MS Word. It´s quite handy feature you can use for creating envelopes, labels, personalized letters etc. First question could be what is this feature good for? Mailing can really he…
Learn how to make your own table of contents in Microsoft Word using paragraph styles and the automatic table of contents tool. We'll be using the paragraph styles in Word’s Home toolbar to help you create a table of contents. Type out your initial …
Office 365 is currently available in five editions. Three of them are for business use: Office 365 Business Essentials, Office 365 Business, and Office 365 Business Premium. Two of them are for home/personal use: Office 365 Home and Office 365 Perso…

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question