Solved

Assign a macro to a button in a Word document

Posted on 2007-11-28
8
2,082 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
 

Author Comment

by:nz_witch
Comment Utility
OK, I added a field, 'Author', changed the text, how do I attach my pre-made macro to it?
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:nz_witch
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Not a problem, glad I could have helped and thanks for the points and grade
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Do you ever need to create a 20 page Word document for some testing purpose? Are you tired of copying & pasting old boring "lorem ipsum" text over and over again, increasing font size and line space in order to make the document 20+ pages long? Look…
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…
This video teaches the viewer how to align pictures around text while keeping the text properly aligned in the document.
This video shows where to find templates, what they are used for, and how to create and save a custom template using Microsoft Word.

762 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now