Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / November 2004

Tip: Looking for answers? Try searching our database.

HELP PLEASE! Inserting a chosen paragraph then inserting form fields into that chosen paragraph!

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Adi - 01 Nov 2004 21:37 GMT
Hello!

For an assignment I have been asked to standardise a word document
using VBA for a life assurance company. It is basically a letter that
is sent out to clients to confirm what type of policy they have taken
out and includes various details.

However I have come stuck with one part of it. Basically depending on
what type of policy is taken out (there are 3 possible choices)
depends on which of 3 different paragraphs have to be included in the
letter.

Firstly then: is there a way that this can be done with VBA or
Macro's?

Also, within the paragraphs there are "variables" that need to be
entered using a userform. Normally I would enter a bookmark in the
place that the variable data would be inserted, but because the
paragraph isn't there until the policy is selected by the user I can't
find a way of inserting a bookmark! Is there some way a bookmark could
be included in the code? Or is there another way that's completely
different?

Many thanks in advance for anyone who can help - my lecturer for this
module stunned me today when she told me she had "limited" knowledge
about visual basic, yet this assignment is all about VBA!!!!
Jezebel - 01 Nov 2004 21:45 GMT
> Hello!
>
[quoted text clipped - 10 lines]
> Firstly then: is there a way that this can be done with VBA or
> Macro's?

VBA and macros are the same thing. You could either put all three paragraphs
in the letter template, each defined by a bookmark. Then according to policy
type delete the two you don't want. Or, define the three paragraphs as
Autotext entries and insert the one you want.

> Also, within the paragraphs there are "variables" that need to be
> entered using a userform. Normally I would enter a bookmark in the
[quoted text clipped - 3 lines]
> be included in the code? Or is there another way that's completely
> different?

If you use method 1 you still can use bookmarks; but a better approach is to
use custom document properties. In code, set the value by setting the
property value. In the document, use a DocProperty field where you want the
value to appear. This will work with either of the paragraph methods, since
Autotext entries may include fields.

> Many thanks in advance for anyone who can help - my lecturer for this
> module stunned me today when she told me she had "limited" knowledge
> about visual basic, yet this assignment is all about VBA!!!!
Adi - 02 Nov 2004 22:06 GMT
Many thanks for the speedy reply to my problem - I can now see light
at the end of the tunnel!

I'm sorry to call on your expertise again, but I am a "newbie" to VBA
and I know more than my lecturer so no help there!

I will go with your first method as it seems the simplist but can you
tell me what the code is for deleting the paragraphs please? I have
tried searching newsgroups and web pages and reading up in books for
the answer but I can't seem to find it!

Again, my humble thanks for yours and anybody else's help!!

> > Hello!
> >
[quoted text clipped - 33 lines]
> > module stunned me today when she told me she had "limited" knowledge
> > about visual basic, yet this assignment is all about VBA!!!!
Jezebel - 02 Nov 2004 22:14 GMT
If you have a bookmark called "Par1", then this deletes whatever the
bookmark refers to --

ActiveDocument.Bookmarks("Par1").Range.Delete

> Many thanks for the speedy reply to my problem - I can now see light
> at the end of the tunnel!
[quoted text clipped - 46 lines]
> > > module stunned me today when she told me she had "limited" knowledge
> > > about visual basic, yet this assignment is all about VBA!!!!
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.