If you can point me to a faq or topic, thank you. If not, bear with me.
I have not used VBA before. I have a Word document using
placeholders/variables. It is used by another application that fills in user
data based on the variables. I would like to personalize the form a bit more
by replacing text such as he/she. I thought perhaps an if/then statement
would work but I haven't a clue how to do this in a Word document. Can it be
done?
Hi pmiker
Start here:
Getting To Grips With VBA Basics In 15 Minutes
http://www.word.mvps.org/FAQs/MacrosVBA/VBABasicsIn15Mins.htm
You'll also need to find out what feature in Word is being used for the
'placeholders'. For example, the placeholders might be bookmarks, fields
that display a Document Property, fields that display a document variable or
some other kind of field.
Once you've done that, if you need more help, post back and tell us some
more about how the document is constructed and what you want to achieve.
Hope this helps.
Shauna Kelly. Microsoft MVP.
http://www.shaunakelly.com/word
> If you can point me to a faq or topic, thank you. If not, bear with me.
>
[quoted text clipped - 7 lines]
> be
> done?
pmiker - 24 Sep 2006 00:11 GMT
I apologize for the vagueness. The form is at work and I should have emailed
it to myself here at home. The forms are used by a product called DVM
Manager. This is veterinary practice software. I have placed something like
the following in the RTF document:
======================================
Client: <<Client.Name>>
Patient: <<Patient.Name>>
Gender: <Patient.Gender>>
Now that <<Patient.Name>> is at home, it is important that he/she ...
==============================================
The variables such as <<Client.Name>> are provided with data from DVM
Manager. I am trying to personalize the form letters as much as possible and
would like to remove instances of he/she and him/her. I thought I could
possibly do this with an if/then/else statement and referencing the
<<Patient.Gender>> variable content.
I have used macros long ago to record keystrokes and I am trying to learn
VB.net but have not used VBA. I have done a bit in C and C++ but have
forgotten most since I was laid off 3-4 years ago.
Mike
> Hi pmiker
>
[quoted text clipped - 26 lines]
> > be
> > done?
Doug Robbins - Word MVP - 24 Sep 2006 07:45 GMT
One would really need to know how DVM is transferring the data into the form
to be sure about this, but you might be able to do it with an
If...then...Else... field construction directly in the document without
needing to use a macro.
Using Ctrl+F9 to insert the { } into the document in place of the he/she
construction the following
{ IF <<Patient Gender>> = "M" "he" "she" }
You will need to replace the M with whatever is contained in the <<Patient
Gender>> field
Your problem however may be that you need to dig into the code in the DVM
application to get it to expose the Patient Gender and that is probably not
for beginners. It may not even be Word VBA, more likely in whatever system
was used for the development of DVM.

Signature
Hope this helps.
Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.
Doug Robbins - Word MVP
>I apologize for the vagueness. The form is at work and I should have
>emailed
[quoted text clipped - 64 lines]
>> > be
>> > done?
pmiker - 24 Sep 2006 13:24 GMT
I will try this. I did not know how to go about adding code instructions
into a document. DVM appears to be working like a mail merge program. I
contacted their tech support earlier and they have not tried anything like
this and could not help. The field names I use were documented in the
programs online help.
I'll go into work this morning and try it.
Thanks,
Mike
> One would really need to know how DVM is transferring the data into the form
> to be sure about this, but you might be able to do it with an
[quoted text clipped - 82 lines]
> >> > be
> >> > done?
Doug Robbins - Word MVP - 24 Sep 2006 14:59 GMT
You can check whether it is using mailmerge by pressing Alt+F9 in the
document in which the <<Client.Name>> appears. If you then see { MERGEFIELD
Client.Name }, then it probably is mailmerge and what I suggested may work.

Signature
Hope this helps.
Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.
Doug Robbins - Word MVP
>I will try this. I did not know how to go about adding code instructions
> into a document. DVM appears to be working like a mail merge program. I
[quoted text clipped - 109 lines]
>> >> > be
>> >> > done?