Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
![]()
i have a form where there may be one objective or many objectives. I want to
have a macro that will add a block of text (for another objective) if needed. I also want to have a button that when pressed by the user, run the macro. |
#2
![]()
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
![]()
BeverlyDawn:
I don't feel like you've given enough information. If you're only talking about a form in the general sense of the word, why not use autotext? The user would only need to type the first few letters and Word would suggest the full name of the autotext entry, allowing the user to press Enter and insert the full text. This could be stored in the form's template, and would be very easy to update. If you're talking about a Word document form (a document protected for forms etc.) wouldn't you need to repeat all the form fields for each objective? If not, where did you imagine putting the button? On the form itself, or in a toolbar? Bear -- Windows XP, Word 2000 "beverlydawn" wrote: i have a form where there may be one objective or many objectives. I want to have a macro that will add a block of text (for another objective) if needed. I also want to have a button that when pressed by the user, run the macro. |
#3
![]()
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
![]()
It is a word form. A coworker wants to be able to just click a button if
there is more that 1 objective for that client. The information that would be needed would be several line long, ex. Objective 2: Patient will: Interventions: Start Date: Completion date: etc. I really didn't think that it would be possible to do this, I was just thinking that there might be a way to have a macro perform the task rather than copy and paste. Thanks "Bear" wrote: BeverlyDawn: I don't feel like you've given enough information. If you're only talking about a form in the general sense of the word, why not use autotext? The user would only need to type the first few letters and Word would suggest the full name of the autotext entry, allowing the user to press Enter and insert the full text. This could be stored in the form's template, and would be very easy to update. If you're talking about a Word document form (a document protected for forms etc.) wouldn't you need to repeat all the form fields for each objective? If not, where did you imagine putting the button? On the form itself, or in a toolbar? Bear -- Windows XP, Word 2000 "beverlydawn" wrote: i have a form where there may be one objective or many objectives. I want to have a macro that will add a block of text (for another objective) if needed. I also want to have a button that when pressed by the user, run the macro. |
#4
![]()
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
![]()
BeverlyDawn:
The application you're describing is what Autotext is meant to do. Except, instead of clicking a button, the user types the first four or so letters of the autotext name. I think anything more would be overkill. But if you think it's important, then you can: 1. Create the objectives data paragraphs, using a SEQ field to number the objectives. This would look like: Objective { SEQ Objective \n } Patient will: Interventions: etc. etc. Note that you don't just type the curly brackets, you have to click Insert Field, select SEQ from the Field Names list, type in the identifier Objective (the Field dialog box shows you where) click Options and add the \n switch (which just means assign the next number in the Objectives sequence.) It's not as hard as it sounds. Try it out in regular text somewhere if you like. You don't have to include the SEQ field if you don't want automatic numbering of the objectives. 2. Select and add the objectives paragraphs to the autotext for the template. Click Insert AutoText AutoText, set the Look In list to the correct template, type in the name Objective for the autotext entry, then click Add. You have to name it Objective for it to work with the following macro. 3. Record a macro named InsertObjective in the correct template. Click Tools Macro Record New Macro, set the Store Macro In list to the correct template. Type InsertObjective in the Macro Name box, then click OK and start recording. There's no rush when you're recording -- take your time. Record the actions of you adding that autotext by clicking Insert Autotext Autotext, selecting the Objectives entry, then clicking Insert. Stop the recording. 4. Check the macro. Click Tools Macro Macros and set the Macros In list to the template. Select the InsertObjective macro then click Edit. This opens the VBE and displays your macro. It should look pretty much like this one (slight differences as I wrote this directly, rather than recording it.) Sub InsertObjective() ' Inserts the Objective autotext at the insertion point ' Macro by David Chinell ' 30APR07 ActiveDocument.AttachedTemplate.AutoTextEntries("O bjective").Insert _ Whe=Selection.Range End Sub Notice that the autotext entry is identified by the name Objective, which is why I asked you to name the autotext that way. You can use whatever name you like, provided they match up. 5. Attach this macro to a toolbar button. You'll have to figure out where you want it to appear -- whether in a standard toolbar or in a custom toolbar you create. Just be sure to save it in the same template we've been using all along, so it's only available when your users are working on that particular form. Click Tools Customize Commands. From the Categories list, select Macros. From the Commands list select your InsertObjective macro. Note that it may have a prefix before it to identify the template it's stored in. Drag the icon for the command onto a toolbar. Right-click on the button and set all the attributes to make it look the way you want it to look. Change the name to the tooltip you want displayed. E.G. "Insert Objective" When you're done creating the button, click Close to close the Customize dialog box and save your work. Test the template by creating a new document and seeing that the button appears in the correct toolbar, that it inserts the autotext, and that the button disappears if you switch to a different document. Autotext is MUCH simpler, but not as much fun. Bear -- Windows XP, Word 2000 |
Reply |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How do you insert a text form field box in your header or footer? | Microsoft Word Help | |||
how do you insert a text form field in ms word? | New Users | |||
Macro to insert AutoText table loses text formatting | Tables | |||
How do I insert a text form field into a table document in word? | Tables | |||
insert text in a form? | Microsoft Word Help |