Solved

Assign a macro to a button in a Word document

Posted on 2007-11-28
8
2,089 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Introduction Authors who set out to write any sort of lengthy piece for online submission—be it a long question or comment on a technical form, an article, or a substantial blog entry—often find it useful to work up a draft in an editor other t…
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 a watermark for their document, customizing it, and saving it for viewing/printing needs.
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…

734 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