just starting

P

pmiker

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?
 
S

Shauna Kelly

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
 
P

pmiker

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
 
D

Doug Robbins - Word MVP

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.

--
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
 
P

pmiker

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
 
D

Doug Robbins - Word MVP

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.

--
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top