OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Macro Newbie, help please

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Writer
View previous topic :: View next topic  
Author Message
Dave013
General User
General User


Joined: 18 Apr 2012
Posts: 7

PostPosted: Wed Apr 18, 2012 10:06 am    Post subject: Macro Newbie, help please Reply with quote

I am looking to be able to type in a person's name and have it appear at set points throughout a preset document.

I am also looking to be able to insert a person's sex in one spot and have it adjust pronouns (his, her, he, she, etc) throughout a present document.

I tried searching for this, but got way too many results to wade through.

Thanks for any help.
Back to top
View user's profile Send private message
JohnV
Administrator
Administrator


Joined: 07 Mar 2003
Posts: 9183
Location: Lexinton, Kentucky, USA

PostPosted: Wed Apr 18, 2012 1:45 pm    Post subject: Reply with quote

You don't need macros for either.

Insert > Fields > Other > Variables tab. Select User Field and Format as Text, name it and click the green check mark. Now select Input Field, in the Reference box put a prompt like, "Enter your name." and click insert. Don't fill in a value unless you want a default one.

You only want one Input Field for any defined variable so select User Field again and move the the next location in your document where you want this variable to appear and click Insert.

Go to the first location where he/she will occur. Overwrite the name of your current User Field with Sex and repeat the steps above. This time you will want to enter a default he or she. Move to the first occurrence of him/her. Click on the Function tab and select Conditional Text. The Condition is
Sex EQ "he"
no quotes are need in the Then and Else boxes. Repeat for his/her, his/hers and etc.

Save your document as a template. When you create a new document from this template (do not open from Recent Documents) you will be prompted for the variable values.
Back to top
View user's profile Send private message
Dave013
General User
General User


Joined: 18 Apr 2012
Posts: 7

PostPosted: Wed Apr 18, 2012 3:13 pm    Post subject: Reply with quote

Thanks so much.

1. If the same pronoun appears at the start of sentences at times and is not at the start at other times is there a way to get it auto capitalized or do I have to do separate fields for each case?

2. Also, is there a way to save the same variables for different documents so that I don't have to start from scratch each time?

3. Another also...this worked great for my first document and then I followed the same steps exactly (I'm fairly certain) and it all works but in the second document I am not getting the automatic prompts like I did in the first one. I have to click on the first instance of name, sex and enter values that way -- what did I do wrong?
Back to top
View user's profile Send private message
JohnV
Administrator
Administrator


Joined: 07 Mar 2003
Posts: 9183
Location: Lexinton, Kentucky, USA

PostPosted: Wed Apr 18, 2012 5:19 pm    Post subject: Reply with quote

Quote:
but in the second document I am not getting the automatic prompts like I did in the first one.
You probably didn't save it as a template. In an .odt file press Ctrl+Shift+F9 to bring up the prompts.
Quote:
2. Also, is there a way to save the same variables for different documents so that I don't have to start from scratch each time?
The best I can think of is to do a Save As on the current document and just rework the language. BTW, you don't want to copy and paste an Input field (cursor changes to finger) but you can easily copy and paste User Fields anywhere you like in your new document.

I don't have any solution the capitalization problem other than what you have already suggested.
Back to top
View user's profile Send private message
Dave013
General User
General User


Joined: 18 Apr 2012
Posts: 7

PostPosted: Sat Apr 21, 2012 9:13 am    Post subject: Reply with quote

JohnV wrote:
Quote:
but in the second document I am not getting the automatic prompts like I did in the first one.
You probably didn't save it as a template. In an .odt file press Ctrl+Shift+F9 to bring up the prompts.
Quote:
2. Also, is there a way to save the same variables for different documents so that I don't have to start from scratch each time?
The best I can think of is to do a Save As on the current document and just rework the language. BTW, you don't want to copy and paste an Input field (cursor changes to finger) but you can easily copy and paste User Fields anywhere you like in your new document.

I don't have any solution the capitalization problem other than what you have already suggested.


I have tried this with several more documents all of which are saved as templates and I sometimes get prompts for the first field (name) but not the other field (sex). Does it matter if the first instance of the sex field (he/she) is before or after the first instance of the function fields (sex EQ)?

Does the primary sex field that the function fields are based on have to be he/she or can it be anything (his/her, etc) as long as I put Sex EQ "his/her" as indicated?
Back to top
View user's profile Send private message
Dave013
General User
General User


Joined: 18 Apr 2012
Posts: 7

PostPosted: Sat Apr 21, 2012 10:04 am    Post subject: Reply with quote

I think I figured it out. I was inserting the wrong type of fields. Thanks for all of your help.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Writer All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group