Insert a new (numbered) paragraph with formfields 
Author Message
 Insert a new (numbered) paragraph with formfields

Hi,

Does anyone know a method to let a user insert a new formatted paragraph,
with some formfields in it,  in a protected form.

I'm having a form with a numbered paragraph on it, with a few formfields of
which some are bold.

Paragraphs should look like:
1 [field1] ( [field2] ) : [field3]
2 [field1a] ( [field2a] ) : [field3a]
... etc.

Everything bold, except field3.

I don't know how many lines the user wants to enter with the format of this
particular paragraph, so I thought I create a macro which is inserting an
autotext of this paragraph after the user tabs out of the last formfield.
(after first unprotecting the form)

So the result is:
1 [field1] ( [field2] ) : [field3
2 [field1a] ( [field2a] ) : [field3a]]
where field1a, field2a, field3a are no field, but just the text what's
inserted in the autotext fields and is inserted in field3.

Thanks in advance.
Bye,
Gijs



Mon, 20 Dec 2004 22:52:31 GMT  
 Insert a new (numbered) paragraph with formfields
Hi Gijs,

Quote:
> Does anyone know a method to let a user insert a new formatted paragraph,
> with some formfields in it,  in a protected form.

I create such "elements" as AutoText entries. The user clicks a toolbar
button, a macro unprotects, positions, inserts the AutoText entry, renames
the form fields (if necessary), reprotects.

You propose the same approach, so apparently this isn't really your
question. What's your question?

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister
http://www.mvps.org/word
http://go.compuserve.com/MSOfficeForum

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :-)



Tue, 21 Dec 2004 15:59:30 GMT  
 Insert a new (numbered) paragraph with formfields
Hi Cindy,

Thanks for your reply!

See below...



Quote:
> Hi Gijs,

> > Does anyone know a method to let a user insert a new formatted
paragraph,
> > with some formfields in it,  in a protected form.

> I create such "elements" as AutoText entries. The user clicks a toolbar
> button, a macro unprotects, positions, inserts the AutoText entry, renames
> the form fields (if necessary), reprotects.

> You propose the same approach, so apparently this isn't really your
> question. What's your question?

So my approach is OK... The problem I have is that the new paragraph seems
to be inserted into the last formfield. Ofcourse it should be in a new
paragraph. Somehow I can't get it done.
So the problem seems to be to create a new paragraph to insert the autotext
in.

I first tried to create a new paragraph with:

Selection.TypeParagraph

Then I read something about collapse and added next lines:

Set myRange = ActiveDocument.Paragraphs(1).Range
myRange.Collapse Direction:=wdCollapseEnd

Then I tried with adding next:

With Selection
    .Move Unit:=wdParagraph
    .InsertParagraphAfter
    .Collapse Direction:=wdCollapseStart
End With

I believe I tried all combinations of above, but still something went wrong
in creating a new paragraph with numbering.

Bye,
Gijs

Quote:

> Cindy Meister
> INTER-Solutions, Switzerland
> http://homepage.swissonline.ch/cindymeister
> http://www.mvps.org/word
> http://go.compuserve.com/MSOfficeForum

> This reply is posted in the Newsgroup; please post any follow question or
> reply in the newsgroup and not by e-mail :-)



Tue, 21 Dec 2004 20:15:19 GMT  
 Insert a new (numbered) paragraph with formfields
Hi Gijs,

Yes, you're very close. Try like this:

Set rng = Selection.Range.Paragraphs(1).Range
'this is where the form field is
rng.Collapse wdCollapseEnd
'now you're in the next paragraph
'you can insert another paragraph, if you wish, with rng.InsertBefore vbCR or
rng.InsertAfter vbCR - test which is best
'now insert the AutoText entry

Quote:
> The problem I have is that the new paragraph seems
> to be inserted into the last formfield. Ofcourse it should be in a new
> paragraph. Somehow I can't get it done.
> So the problem seems to be to create a new paragraph to insert the autotext
> in.

> I first tried to create a new paragraph with:

> Selection.TypeParagraph

> Then I read something about collapse and added next lines:

> Set myRange = ActiveDocument.Paragraphs(1).Range
> myRange.Collapse Direction:=wdCollapseEnd

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister
http://www.mvps.org/word
http://go.compuserve.com/MSOfficeForum

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :-)



Wed, 22 Dec 2004 16:29:22 GMT  
 Insert a new (numbered) paragraph with formfields
Hi Cindy,

I can't get it working. It's still inserting the autotext in the last
formfield :-(
I think I'm giving up... don't know how to get it done (I'm programming (gui
/ not vb) since 1994, but VBA is still a mystery for me and the help is not
very useful)

Thanks again for your advices.

Bye,
Gijs



Quote:
> Hi Gijs,

> Yes, you're very close. Try like this:

> Set rng = Selection.Range.Paragraphs(1).Range
> 'this is where the form field is
> rng.Collapse wdCollapseEnd
> 'now you're in the next paragraph
> 'you can insert another paragraph, if you wish, with rng.InsertBefore vbCR
or
> rng.InsertAfter vbCR - test which is best
> 'now insert the AutoText entry

> > The problem I have is that the new paragraph seems
> > to be inserted into the last formfield. Ofcourse it should be in a new
> > paragraph. Somehow I can't get it done.
> > So the problem seems to be to create a new paragraph to insert the
autotext
> > in.

> > I first tried to create a new paragraph with:

> > Selection.TypeParagraph

> > Then I read something about collapse and added next lines:

> > Set myRange = ActiveDocument.Paragraphs(1).Range
> > myRange.Collapse Direction:=wdCollapseEnd

> Cindy Meister
> INTER-Solutions, Switzerland
> http://homepage.swissonline.ch/cindymeister
> http://www.mvps.org/word
> http://go.compuserve.com/MSOfficeForum

> This reply is posted in the Newsgroup; please post any follow question or
> reply in the newsgroup and not by e-mail :-)



Sat, 25 Dec 2004 02:47:50 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. inserting a number tag in a particular paragraph

2. inserting formfields into tables

3. Inserting Text into a FormField

4. Insert autotext entry in formfield

5. Inserting File in Formfields

6. Inserting formfields in a Header

7. Index number of Active FormField

8. Align only last-inserted paragraph in footer

9. Inserting paragraph in the table using VB

10. Inserting a paragraph at end of document?

11. How to insert paragraph (\par RTF tag) using VBA

12. How to insert paragraph between picture & text

 

 
Powered by phpBB® Forum Software