Solved

Assign a macro to a button in a Word document

Posted on 2007-11-28
8
2,086 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
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction This tutorial provides instructions on how to properly format your Word document using the inbuilt tools provided. The benefits of using these tools means your documents are more accessible and easily portable to other applications an…
Preface: When I started this series, I used the term CommandBars because that is the Office Object class that it discusses. Unfortunately, when Microsoft introduced Office 2007, they replaced the standard Commandbar menus with "The Ribbon" and rem…
This video walks the viewer through the process of creating envelopes and labels, with multiple names and addresses. Navigate to the “Start Mail Merge” button in the Mailings tab: Follow the step-by-step process until asked to find the address doc…
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …

749 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