If true Insert Autotext 
Author Message
 If true Insert Autotext

Could someone have a go at coding :

If CheckBox1 = True
Find end of doc
Insert Section Break (New Page)
Insert AutoTextEntry (myAutoText)

The help files on both the CheckBox and AutoTextEntry are a bit confusing
for a newbie and Im having trouble understanding if defining a Range is
necessary when I only wish to insert the AutoText at the end of the doc.

As always, any help greatly appreciated.
Cas



Tue, 30 Dec 2003 18:33:36 GMT  
 If true Insert Autotext

Assuming this is a userform checkbox, not an ActiveX control embedded
in a document:

[This code is untested.]

Private Sub OK_Click() '<--assumes button to dismiss form is named 'OK'
Dim r as Range
If CheckBox1.Value = True Then
  Set r = ActiveDocument.Content
  r.Collapse wdCollapseEnd
  r.InsertBreak Type:=wdSectionBreakNextPage
  ActiveDocument.AttachedTemplate.AutoTextEntries("myAutoText"). _
    Insert Where:=r, RichText:=True '<--assumes AutoText is formatted
End If
End Sub


------ WWW: http://www.speakeasy.org/~mtangard ----------------------
------------- "Life is nothing if you aren't obsessed." --John Waters
---------------------------------------------------------------------

Quote:

> Could someone have a go at coding :

> If CheckBox1 = True
> Find end of doc
> Insert Section Break (New Page)
> Insert AutoTextEntry (myAutoText)

> The help files on both the CheckBox and AutoTextEntry are a bit confusing
> for a newbie and Im having trouble understanding if defining a Range is
> necessary when I only wish to insert the AutoText at the end of the doc.

> As always, any help greatly appreciated.
> Cas



Tue, 30 Dec 2003 19:18:22 GMT  
 If true Insert Autotext
Boy you're quick !!
I'll try this and get back to you
Thanks and have a good week-end
Cas


Quote:

> Assuming this is a userform checkbox, not an ActiveX control embedded
> in a document:

> [This code is untested.]

> Private Sub OK_Click() '<--assumes button to dismiss form is named 'OK'
> Dim r as Range
> If CheckBox1.Value = True Then
>   Set r = ActiveDocument.Content
>   r.Collapse wdCollapseEnd
>   r.InsertBreak Type:=wdSectionBreakNextPage
>   ActiveDocument.AttachedTemplate.AutoTextEntries("myAutoText"). _
>     Insert Where:=r, RichText:=True '<--assumes AutoText is formatted
> End If
> End Sub


> ------ WWW: http://www.speakeasy.org/~mtangard ----------------------
> ------------- "Life is nothing if you aren't obsessed." --John Waters
> ---------------------------------------------------------------------


> > Could someone have a go at coding :

> > If CheckBox1 = True
> > Find end of doc
> > Insert Section Break (New Page)
> > Insert AutoTextEntry (myAutoText)

> > The help files on both the CheckBox and AutoTextEntry are a bit
confusing
> > for a newbie and Im having trouble understanding if defining a Range is
> > necessary when I only wish to insert the AutoText at the end of the doc.

> > As always, any help greatly appreciated.
> > Cas



Tue, 30 Dec 2003 19:21:40 GMT  
 If true Insert Autotext

Quote:

> Boy you're quick !!

Ah, 44 minutes ain't so quick.  ;)


Tue, 30 Dec 2003 19:31:19 GMT  
 If true Insert Autotext

Quote:

> Ah, 44 minutes ain't so quick.  ;)

Listen Mate - where I work, ANY kind of an answer in 44 mins is positivley
lightning-like ! ;)


Tue, 30 Dec 2003 19:49:18 GMT  
 If true Insert Autotext
Mark - if you are following this thread, maybe you could repost the code
from your earlier post. I have been away for a few days and previous
messages seem to be missing from the server ?  As an after thought - is
there anyway to regenerate them ?

Cas


Quote:

> > Ah, 44 minutes ain't so quick.  ;)

> Listen Mate - where I work, ANY kind of an answer in 44 mins is positivley
> lightning-like ! ;)



Mon, 05 Jan 2004 21:40:05 GMT  
 If true Insert Autotext
Mark - Maybe you could have a look at "If true - insert at bookmark"
Thanks again

Cas


Quote:
> Mark - if you are following this thread, maybe you could repost the code
> from your earlier post. I have been away for a few days and previous
> messages seem to be missing from the server ?  As an after thought - is
> there anyway to regenerate them ?

> Cas




> > > Ah, 44 minutes ain't so quick.  ;)

> > Listen Mate - where I work, ANY kind of an answer in 44 mins is
positivley
> > lightning-like ! ;)



Mon, 05 Jan 2004 22:16:59 GMT  
 If true Insert Autotext
Cas,

You can find past posts from these groups by an easy search at Google:
http://groups.google.com/advanced_group_search

But the post you're looking for isn't that old.  If you're connecting
directly to the Microsoft server to read these newsgroups (rather than
via your ISP), you should be able to see it just by turning on the
display of "read" messages.  In any case, here it is below.

Mark

Assuming this is a userform checkbox, not an ActiveX control embedded
in a document:

[This code is untested.]

Private Sub OK_Click() '<--assumes button to dismiss form is named 'OK'
Dim r as Range
If CheckBox1.Value = True Then
  Set r = ActiveDocument.Content
  r.Collapse wdCollapseEnd
  r.InsertBreak Type:=wdSectionBreakNextPage
  ActiveDocument.AttachedTemplate.AutoTextEntries("myAutoText"). _
    Insert Where:=r, RichText:=True '<--assumes AutoText is formatted
End If
End Sub


------ WWW: http://www.speakeasy.org/~mtangard ----------------------
------------- "Life is nothing if you aren't obsessed." --John Waters
---------------------------------------------------------------------

Quote:

> Could someone have a go at coding :

> If CheckBox1 = True
> Find end of doc
> Insert Section Break (New Page)
> Insert AutoTextEntry (myAutoText)

> The help files on both the CheckBox and AutoTextEntry are a bit confusing
> for a newbie and Im having trouble understanding if defining a Range is
> necessary when I only wish to insert the AutoText at the end of the doc.

> As always, any help greatly appreciated.
> Cas

> Mark - if you are following this thread, maybe you could repost the code
> from your earlier post. I have been away for a few days and previous
> messages seem to be missing from the server ?  As an after thought - is
> there anyway to regenerate them ?

> Cas




> > > Ah, 44 minutes ain't so quick.  ;)

> > Listen Mate - where I work, ANY kind of an answer in 44 mins is positivley
> > lightning-like ! ;)



Mon, 05 Jan 2004 22:54:45 GMT  
 If true Insert Autotext
| If you're connecting
| directly to the Microsoft server

If not, you can click the following link to connect to it:

Regards

Dave



Tue, 06 Jan 2004 08:57:09 GMT  
 If true Insert Autotext
Hi Dave

The Server name in Accounts>Properties is msnews.microsoft.com although I do
connect through an ISP - My "View" is set to all messages and synchronise is
set to headers only - but still OL only shows messages since 13/07/01 12:49
(BST) for this thread.  I also have noticed that some headers that are
downloaded at work do not appear when I synchronise at home (different PC
using same settings).
As an experiment, I connected to my ISP's news server and subscribed to
microsoft.public.word.vba.general - this produces a slightly different list
of headers than when connecting to msnews.microsoft.com - any ideas?

Cas


Quote:
> | If you're connecting
> | directly to the Microsoft server

> If not, you can click the following link to connect to it:

> Regards

> Dave



Tue, 06 Jan 2004 16:30:30 GMT  
 If true Insert Autotext
Hi Cas,

Try resetting the newsgroups via Tools>Options>Maintenance>Clean up
now>Reset

Please post any follow-up or new questions to the Newsgroups so that others
may benefit therefrom or contribute thereto.

Hope this helps,
Doug Robbins - Word MVP

Quote:
> Hi Dave

> The Server name in Accounts>Properties is msnews.microsoft.com although I
do
> connect through an ISP - My "View" is set to all messages and synchronise
is
> set to headers only - but still OL only shows messages since 13/07/01
12:49
> (BST) for this thread.  I also have noticed that some headers that are
> downloaded at work do not appear when I synchronise at home (different PC
> using same settings).
> As an experiment, I connected to my ISP's news server and subscribed to
> microsoft.public.word.vba.general - this produces a slightly different
list
> of headers than when connecting to msnews.microsoft.com - any ideas?

> Cas



> > | If you're connecting
> > | directly to the Microsoft server

> > If not, you can click the following link to connect to it:

> > Regards

> > Dave



Tue, 06 Jan 2004 20:56:36 GMT  
 If true Insert Autotext
Hi Mark
I have been trying to set up checkboxes on a UserForm that when selected
update a FormField checkbox to selected also -

'Set CheckBoxes
If ufChkPhone.Value = True Then
    ActiveDocument.FormFields("chkPhone").CheckBox.Value = True
    Else
    ActiveDocument.FormFields("chkPhone").CheckBox.Value = False
     End If

This works fine but I have 4 of these which means 4 entries of the above
code in my OK button click event.  I now have a need for 12 chkboxes on a
UserForm and corresponding FormFields and I dont really want 12 repetitions
of above to perform a simple task like this - Im sure there is a better way!

Any pointers ?

Cas


Quote:
> Cas,

> You can find past posts from these groups by an easy search at Google:
> http://groups.google.com/advanced_group_search

> But the post you're looking for isn't that old.  If you're connecting
> directly to the Microsoft server to read these newsgroups (rather than
> via your ISP), you should be able to see it just by turning on the
> display of "read" messages.  In any case, here it is below.

> Mark

> Assuming this is a userform checkbox, not an ActiveX control embedded
> in a document:

> [This code is untested.]

> Private Sub OK_Click() '<--assumes button to dismiss form is named 'OK'
> Dim r as Range
> If CheckBox1.Value = True Then
>   Set r = ActiveDocument.Content
>   r.Collapse wdCollapseEnd
>   r.InsertBreak Type:=wdSectionBreakNextPage
>   ActiveDocument.AttachedTemplate.AutoTextEntries("myAutoText"). _
>     Insert Where:=r, RichText:=True '<--assumes AutoText is formatted
> End If
> End Sub


> ------ WWW: http://www.speakeasy.org/~mtangard ----------------------
> ------------- "Life is nothing if you aren't obsessed." --John Waters
> ---------------------------------------------------------------------


> > Could someone have a go at coding :

> > If CheckBox1 = True
> > Find end of doc
> > Insert Section Break (New Page)
> > Insert AutoTextEntry (myAutoText)

> > The help files on both the CheckBox and AutoTextEntry are a bit
confusing
> > for a newbie and Im having trouble understanding if defining a Range is
> > necessary when I only wish to insert the AutoText at the end of the doc.

> > As always, any help greatly appreciated.
> > Cas


> > Mark - if you are following this thread, maybe you could repost the code
> > from your earlier post. I have been away for a few days and previous
> > messages seem to be missing from the server ?  As an after thought - is
> > there anyway to regenerate them ?

> > Cas




> > > > Ah, 44 minutes ain't so quick.  ;)

> > > Listen Mate - where I work, ANY kind of an answer in 44 mins is
positivley
> > > lightning-like ! ;)



Sat, 10 Jan 2004 20:08:39 GMT  
 If true Insert Autotext
Hi Cas,

If the naming of the UserForm CheckBoxes and the document FormFields is
consistant, the following will work. It looks like the name of the UserForm
CheckBoxes is the same as the name of the FormFields with a "uf" pre-pended
eg:

ufChkPhone -> chkPhone
ufChkName -> chkName
ufChkFax -> chkFax

-------------------------------------------------------------------------

Dim oControl As Control
Dim strFormField As String

For Each oControl In Me.Controls

    If TypeOf oControl Is MSForms.CheckBox Then

        strFormField = Right$(oControl.Name, Len(oControl.Name) - 2)

        ActiveDocument.FormFields(strFormField). _
                CheckBox.Value = oControl.Value

    End If

Next oControl

-------------------------------------------------------------------------

Hope this helps.
ibby

Please post replies or follow-ups to the **newsgroup** so that participants
may benefit or contribute.


Quote:
> Hi Mark
> I have been trying to set up checkboxes on a UserForm that when selected
> update a FormField checkbox to selected also -

> 'Set CheckBoxes
> If ufChkPhone.Value = True Then
>     ActiveDocument.FormFields("chkPhone").CheckBox.Value = True
>     Else
>     ActiveDocument.FormFields("chkPhone").CheckBox.Value = False
>      End If

> This works fine but I have 4 of these which means 4 entries of the above
> code in my OK button click event.  I now have a need for 12 chkboxes on a
> UserForm and corresponding FormFields and I dont really want 12
repetitions
> of above to perform a simple task like this - Im sure there is a better
way!

> Any pointers ?

> Cas



> > Cas,

> > You can find past posts from these groups by an easy search at Google:
> > http://groups.google.com/advanced_group_search

> > But the post you're looking for isn't that old.  If you're connecting
> > directly to the Microsoft server to read these newsgroups (rather than
> > via your ISP), you should be able to see it just by turning on the
> > display of "read" messages.  In any case, here it is below.

> > Mark

> > Assuming this is a userform checkbox, not an ActiveX control embedded
> > in a document:

> > [This code is untested.]

> > Private Sub OK_Click() '<--assumes button to dismiss form is named 'OK'
> > Dim r as Range
> > If CheckBox1.Value = True Then
> >   Set r = ActiveDocument.Content
> >   r.Collapse wdCollapseEnd
> >   r.InsertBreak Type:=wdSectionBreakNextPage
> >   ActiveDocument.AttachedTemplate.AutoTextEntries("myAutoText"). _
> >     Insert Where:=r, RichText:=True '<--assumes AutoText is formatted
> > End If
> > End Sub


> > ------ WWW: http://www.speakeasy.org/~mtangard ----------------------
> > ------------- "Life is nothing if you aren't obsessed." --John Waters
> > ---------------------------------------------------------------------


> > > Could someone have a go at coding :

> > > If CheckBox1 = True
> > > Find end of doc
> > > Insert Section Break (New Page)
> > > Insert AutoTextEntry (myAutoText)

> > > The help files on both the CheckBox and AutoTextEntry are a bit
> confusing
> > > for a newbie and Im having trouble understanding if defining a Range
is
> > > necessary when I only wish to insert the AutoText at the end of the
doc.

> > > As always, any help greatly appreciated.
> > > Cas


> > > Mark - if you are following this thread, maybe you could repost the
code
> > > from your earlier post. I have been away for a few days and previous
> > > messages seem to be missing from the server ?  As an after thought -
is
> > > there anyway to regenerate them ?

> > > Cas




> > > > > Ah, 44 minutes ain't so quick.  ;)

> > > > Listen Mate - where I work, ANY kind of an answer in 44 mins is
> positivley
> > > > lightning-like ! ;)



Sat, 10 Jan 2004 22:04:28 GMT  
 If true Insert Autotext
Ibby - your'e a star !

I've no idea of whats going on - but it works a treat !

Many thanks

Quote:
> Hi Cas,

> If the naming of the UserForm CheckBoxes and the document FormFields
is
> consistant, the following will work. It looks like the name of the
UserForm
> CheckBoxes is the same as the name of the FormFields with a "uf"
pre-pended
> eg:

> ufChkPhone -> chkPhone
> ufChkName -> chkName
> ufChkFax -> chkFax

> --------------------------------------------------------------------
-----

> Dim oControl As Control
> Dim strFormField As String

> For Each oControl In Me.Controls

>     If TypeOf oControl Is MSForms.CheckBox Then

>         strFormField = Right$(oControl.Name, Len(oControl.Name) - 2)

>         ActiveDocument.FormFields(strFormField). _
>                 CheckBox.Value = oControl.Value

>     End If

> Next oControl

> --------------------------------------------------------------------
-----

> Hope this helps.
> ibby

> Please post replies or follow-ups to the **newsgroup** so that
participants
> may benefit or contribute.



> > Hi Mark
> > I have been trying to set up checkboxes on a UserForm that when
selected
> > update a FormField checkbox to selected also -

> > 'Set CheckBoxes
> > If ufChkPhone.Value = True Then
> >     ActiveDocument.FormFields("chkPhone").CheckBox.Value = True
> >     Else
> >     ActiveDocument.FormFields("chkPhone").CheckBox.Value = False
> >      End If

> > This works fine but I have 4 of these which means 4 entries of the
above
> > code in my OK button click event.  I now have a need for 12
chkboxes on a
> > UserForm and corresponding FormFields and I dont really want 12
> repetitions
> > of above to perform a simple task like this - Im sure there is a
better
> way!

> > Any pointers ?

> > Cas



> > > Cas,

> > > You can find past posts from these groups by an easy search at
Google:
> > > http://groups.google.com/advanced_group_search

> > > But the post you're looking for isn't that old.  If you're
connecting
> > > directly to the Microsoft server to read these newsgroups
(rather than
> > > via your ISP), you should be able to see it just by turning on
the
> > > display of "read" messages.  In any case, here it is below.

> > > Mark

> > > Assuming this is a userform checkbox, not an ActiveX control
embedded
> > > in a document:

> > > [This code is untested.]

> > > Private Sub OK_Click() '<--assumes button to dismiss form is
named 'OK'
> > > Dim r as Range
> > > If CheckBox1.Value = True Then
> > >   Set r = ActiveDocument.Content
> > >   r.Collapse wdCollapseEnd
> > >   r.InsertBreak Type:=wdSectionBreakNextPage
> > >   ActiveDocument.AttachedTemplate.AutoTextEntries("myAutoText").
_
> > >     Insert Where:=r, RichText:=True '<--assumes AutoText is
formatted
> > > End If
> > > End Sub

> > > -- Mark Tangard


Quote:
> > > ------ WWW:

http://www.speakeasy.org/~mtangard ----------------------

- Show quoted text -

Quote:
> > > ------------- "Life is nothing if you aren't obsessed." --John
Waters

> --------------------------------------------------------------------
-


> > > > Could someone have a go at coding :

> > > > If CheckBox1 = True
> > > > Find end of doc
> > > > Insert Section Break (New Page)
> > > > Insert AutoTextEntry (myAutoText)

> > > > The help files on both the CheckBox and AutoTextEntry are a
bit
> > confusing
> > > > for a newbie and Im having trouble understanding if defining a
Range
> is
> > > > necessary when I only wish to insert the AutoText at the end
of the
> doc.

> > > > As always, any help greatly appreciated.
> > > > Cas


> > > > Mark - if you are following this thread, maybe you could
repost the
> code
> > > > from your earlier post. I have been away for a few days and
previous
> > > > messages seem to be missing from the server ?  As an after
thought -
> is
> > > > there anyway to regenerate them ?

> > > > Cas




> > > > > > Ah, 44 minutes ain't so quick.  ;)

> > > > > Listen Mate - where I work, ANY kind of an answer in 44 mins
is
> > positivley
> > > > > lightning-like ! ;)



Sat, 10 Jan 2004 23:38:39 GMT  
 If true Insert Autotext
Hi Ibby
User has now indicated that he may wish to modify his selections at a
later date.  All the checkboxes are in positions where I can divide
the .dot into four sections. Sections 1 & 3 contain the checkboxes so
I would need to have these Secs protected, which I have done - what I
need help with is the code to unprotect and then re-protect them from
the OK button click event on the userForm.

Any advice greatly appreciated.

Cas


Quote:
> Hi Cas,

> If the naming of the UserForm CheckBoxes and the document FormFields
is
> consistant, the following will work. It looks like the name of the
UserForm
> CheckBoxes is the same as the name of the FormFields with a "uf"
pre-pended
> eg:

> ufChkPhone -> chkPhone
> ufChkName -> chkName
> ufChkFax -> chkFax

> --------------------------------------------------------------------
-----

> Dim oControl As Control
> Dim strFormField As String

> For Each oControl In Me.Controls

>     If TypeOf oControl Is MSForms.CheckBox Then

>         strFormField = Right$(oControl.Name, Len(oControl.Name) - 2)

>         ActiveDocument.FormFields(strFormField). _
>                 CheckBox.Value = oControl.Value

>     End If

> Next oControl

> --------------------------------------------------------------------
-----

> Hope this helps.
> ibby

> Please post replies or follow-ups to the **newsgroup** so that
participants
> may benefit or contribute.



> > Hi Mark
> > I have been trying to set up checkboxes on a UserForm that when
selected
> > update a FormField checkbox to selected also -

> > 'Set CheckBoxes
> > If ufChkPhone.Value = True Then
> >     ActiveDocument.FormFields("chkPhone").CheckBox.Value = True
> >     Else
> >     ActiveDocument.FormFields("chkPhone").CheckBox.Value = False
> >      End If

> > This works fine but I have 4 of these which means 4 entries of the
above
> > code in my OK button click event.  I now have a need for 12
chkboxes on a
> > UserForm and corresponding FormFields and I dont really want 12
> repetitions
> > of above to perform a simple task like this - Im sure there is a
better
> way!

> > Any pointers ?

> > Cas



> > > Cas,

> > > You can find past posts from these groups by an easy search at
Google:
> > > http://groups.google.com/advanced_group_search

> > > But the post you're looking for isn't that old.  If you're
connecting
> > > directly to the Microsoft server to read these newsgroups
(rather than
> > > via your ISP), you should be able to see it just by turning on
the
> > > display of "read" messages.  In any case, here it is below.

> > > Mark

> > > Assuming this is a userform checkbox, not an ActiveX control
embedded
> > > in a document:

> > > [This code is untested.]

> > > Private Sub OK_Click() '<--assumes button to dismiss form is
named 'OK'
> > > Dim r as Range
> > > If CheckBox1.Value = True Then
> > >   Set r = ActiveDocument.Content
> > >   r.Collapse wdCollapseEnd
> > >   r.InsertBreak Type:=wdSectionBreakNextPage
> > >   ActiveDocument.AttachedTemplate.AutoTextEntries("myAutoText").
_
> > >     Insert Where:=r, RichText:=True '<--assumes AutoText is
formatted
> > > End If
> > > End Sub

> > > -- Mark Tangard


Quote:
> > > ------ WWW:

http://www.speakeasy.org/~mtangard ----------------------

- Show quoted text -

Quote:
> > > ------------- "Life is nothing if you aren't obsessed." --John
Waters

> --------------------------------------------------------------------
-


> > > > Could someone have a go at coding :

> > > > If CheckBox1 = True
> > > > Find end of doc
> > > > Insert Section Break (New Page)
> > > > Insert AutoTextEntry (myAutoText)

> > > > The help files on both the CheckBox and AutoTextEntry are a
bit
> > confusing
> > > > for a newbie and Im having trouble understanding if defining a
Range
> is
> > > > necessary when I only wish to insert the AutoText at the end
of the
> doc.

> > > > As always, any help greatly appreciated.
> > > > Cas


> > > > Mark - if you are following this thread, maybe you could
repost the
> code
> > > > from your earlier post. I have been away for a few days and
previous
> > > > messages seem to be missing from the server ?  As an after
thought -
> is
> > > > there anyway to regenerate them ?

> > > > Cas




> > > > > > Ah, 44 minutes ain't so quick.  ;)

> > > > > Listen Mate - where I work, ANY kind of an answer in 44 mins
is
> > positivley
> > > > > lightning-like ! ;)



Sun, 11 Jan 2004 17:44:19 GMT  
 
 [ 21 post ]  Go to page: [1] [2]

 Relevant Pages 

1. Macro that inserts Autotext loses styles of Autotext entry

2. Problem with format on insert autotext, and in inserting elements with form fields

3. Inserting AutoText in Header and retaining formatting

4. Inserting AutoText from a Global Template

5. Insert autotext with VBa

6. Insert Autotext Entries in a Document

7. Autotext Insert in Cell Using Range

8. Word XP- Insert Autotext- Tables

9. Insert AutoText in Footer via Macro

10. Inserting Autotext using VBA - loses formatting and styles

11. Insert autotext with vba

12. Programmatically inserting AutoText

 

 
Powered by phpBB® Forum Software