I have a letter template macro as a form chooser and I would like to add
various autotext in a list so that they can be added to the address bookmark
in the template. Is there a way or would I have to add each company name to
a module as an additem and then put the addresses in a macro in the form
chooser? If there is a better way which will pick up the autotex which are
contained in a global template in startup then that would be great as then I
wouldn't have to add a new macro every time someone requires a new address
adding to the list.

Many thanks

Re: Adding autotex to a template by Jonathan

Jonathan
Wed Jun 28 11:31:56 CDT 2006


"Addy" <Addy@discussions.microsoft.com> wrote in message
news:B1201018-3470-44E6-979C-CE535120D998@microsoft.com...
>I have a letter template macro as a form chooser and I would like to add
> various autotext in a list so that they can be added to the address
> bookmark
> in the template. Is there a way or would I have to add each company name
> to
> a module as an additem and then put the addresses in a macro in the form
> chooser? If there is a better way which will pick up the autotex which
> are
> contained in a global template in startup then that would be great as then
> I
> wouldn't have to add a new macro every time someone requires a new address
> adding to the list.


In VBA, you can create a loop to iterate through the AutotextEntries
collection of any Template object, get the Name property of each
AutoTextEntry in turn and use Additem to add that to the listbox in your
form. Something like this

Dim oTemplate As Template
Dim oAuto as AutotextEntry
Set oTemplate = Addins("My Global Template.dot")
For Each oAuto in oTemplate.AutoTextEntries
ListBox1.AddItem oAuto.Name
Next oAuto


--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org


Re: Adding autotex to a template by Addy

Addy
Tue Aug 22 08:30:01 CDT 2006

I tried the below but it doesn't seem to work. Please could you let me know
what I am doing wrong.

The below bit I put in my form chooser:-

Dim oTemplate As Template
Dim oAuto As AutoTextEntry

Set oTemplate = AddIns("legal.dot")

The below was put in a new module:-

With frmChooser 'frmchooser is my form (a letter template)

For Each oAuto In oTemplate.AutoTextEntries
CBOAddress.AddItem oAuto.Name
Next oAuto
.Show
End With

Anyone any ideas please

cheers

"Jonathan West" wrote:

>
> "Addy" <Addy@discussions.microsoft.com> wrote in message
> news:B1201018-3470-44E6-979C-CE535120D998@microsoft.com...
> >I have a letter template macro as a form chooser and I would like to add
> > various autotext in a list so that they can be added to the address
> > bookmark
> > in the template. Is there a way or would I have to add each company name
> > to
> > a module as an additem and then put the addresses in a macro in the form
> > chooser? If there is a better way which will pick up the autotex which
> > are
> > contained in a global template in startup then that would be great as then
> > I
> > wouldn't have to add a new macro every time someone requires a new address
> > adding to the list.
>
>
> In VBA, you can create a loop to iterate through the AutotextEntries
> collection of any Template object, get the Name property of each
> AutoTextEntry in turn and use Additem to add that to the listbox in your
> form. Something like this
>
> Dim oTemplate As Template
> Dim oAuto as AutotextEntry
> Set oTemplate = Addins("My Global Template.dot")
> For Each oAuto in oTemplate.AutoTextEntries
> ListBox1.AddItem oAuto.Name
> Next oAuto
>
>
> --
> Regards
> Jonathan West - Word MVP
> www.intelligentdocuments.co.uk
> Please reply to the newsgroup
> Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org
>
>

Re: Adding autotex to a template by Jonathan

Jonathan
Tue Aug 22 09:13:20 CDT 2006

Hi Addy

This line is wrong

CBOAddress.AddItem oAuto.Name

Its should be this

.CBOAddress.AddItem oAuto.Name

Note the extra period at the start of the line. That is what links it to the
"With frmChooser" statement

--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org

"Addy" <Addy@discussions.microsoft.com> wrote in message
news:290B860B-52AD-4804-A7CA-2BC4C7FC05AF@microsoft.com...
>I tried the below but it doesn't seem to work. Please could you let me
>know
> what I am doing wrong.
>
> The below bit I put in my form chooser:-
>
> Dim oTemplate As Template
> Dim oAuto As AutoTextEntry
>
> Set oTemplate = AddIns("legal.dot")
>
> The below was put in a new module:-
>
> With frmChooser 'frmchooser is my form (a letter template)
>
> For Each oAuto In oTemplate.AutoTextEntries
> CBOAddress.AddItem oAuto.Name
> Next oAuto
> .Show
> End With
>
> Anyone any ideas please
>
> cheers
>
> "Jonathan West" wrote:
>
>>
>> "Addy" <Addy@discussions.microsoft.com> wrote in message
>> news:B1201018-3470-44E6-979C-CE535120D998@microsoft.com...
>> >I have a letter template macro as a form chooser and I would like to add
>> > various autotext in a list so that they can be added to the address
>> > bookmark
>> > in the template. Is there a way or would I have to add each company
>> > name
>> > to
>> > a module as an additem and then put the addresses in a macro in the
>> > form
>> > chooser? If there is a better way which will pick up the autotex which
>> > are
>> > contained in a global template in startup then that would be great as
>> > then
>> > I
>> > wouldn't have to add a new macro every time someone requires a new
>> > address
>> > adding to the list.
>>
>>
>> In VBA, you can create a loop to iterate through the AutotextEntries
>> collection of any Template object, get the Name property of each
>> AutoTextEntry in turn and use Additem to add that to the listbox in your
>> form. Something like this
>>
>> Dim oTemplate As Template
>> Dim oAuto as AutotextEntry
>> Set oTemplate = Addins("My Global Template.dot")
>> For Each oAuto in oTemplate.AutoTextEntries
>> ListBox1.AddItem oAuto.Name
>> Next oAuto
>>
>>
>> --
>> Regards
>> Jonathan West - Word MVP
>> www.intelligentdocuments.co.uk
>> Please reply to the newsgroup
>> Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org
>>
>>


Re: Adding autotex to a template by Addy

Addy
Tue Aug 22 09:43:01 CDT 2006

Many thanks. I've changed that but now it doesn't like this line:

For Each oAuto In oTemplate.AutoTextEntries

When I hover over oAuto it says its empty

Cheers

"Jonathan West" wrote:

> Hi Addy
>
> This line is wrong
>
> CBOAddress.AddItem oAuto.Name
>
> Its should be this
>
> .CBOAddress.AddItem oAuto.Name
>
> Note the extra period at the start of the line. That is what links it to the
> "With frmChooser" statement
>
> --
> Regards
> Jonathan West - Word MVP
> www.intelligentdocuments.co.uk
> Please reply to the newsgroup
> Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org
>
> "Addy" <Addy@discussions.microsoft.com> wrote in message
> news:290B860B-52AD-4804-A7CA-2BC4C7FC05AF@microsoft.com...
> >I tried the below but it doesn't seem to work. Please could you let me
> >know
> > what I am doing wrong.
> >
> > The below bit I put in my form chooser:-
> >
> > Dim oTemplate As Template
> > Dim oAuto As AutoTextEntry
> >
> > Set oTemplate = AddIns("legal.dot")
> >
> > The below was put in a new module:-
> >
> > With frmChooser 'frmchooser is my form (a letter template)
> >
> > For Each oAuto In oTemplate.AutoTextEntries
> > CBOAddress.AddItem oAuto.Name
> > Next oAuto
> > .Show
> > End With
> >
> > Anyone any ideas please
> >
> > cheers
> >
> > "Jonathan West" wrote:
> >
> >>
> >> "Addy" <Addy@discussions.microsoft.com> wrote in message
> >> news:B1201018-3470-44E6-979C-CE535120D998@microsoft.com...
> >> >I have a letter template macro as a form chooser and I would like to add
> >> > various autotext in a list so that they can be added to the address
> >> > bookmark
> >> > in the template. Is there a way or would I have to add each company
> >> > name
> >> > to
> >> > a module as an additem and then put the addresses in a macro in the
> >> > form
> >> > chooser? If there is a better way which will pick up the autotex which
> >> > are
> >> > contained in a global template in startup then that would be great as
> >> > then
> >> > I
> >> > wouldn't have to add a new macro every time someone requires a new
> >> > address
> >> > adding to the list.
> >>
> >>
> >> In VBA, you can create a loop to iterate through the AutotextEntries
> >> collection of any Template object, get the Name property of each
> >> AutoTextEntry in turn and use Additem to add that to the listbox in your
> >> form. Something like this
> >>
> >> Dim oTemplate As Template
> >> Dim oAuto as AutotextEntry
> >> Set oTemplate = Addins("My Global Template.dot")
> >> For Each oAuto in oTemplate.AutoTextEntries
> >> ListBox1.AddItem oAuto.Name
> >> Next oAuto
> >>
> >>
> >> --
> >> Regards
> >> Jonathan West - Word MVP
> >> www.intelligentdocuments.co.uk
> >> Please reply to the newsgroup
> >> Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org
> >>
> >>
>
>

Re: Adding autotex to a template by Jonathan

Jonathan
Tue Aug 22 10:31:46 CDT 2006


"Addy" <Addy@discussions.microsoft.com> wrote in message
news:51AE8A72-8FA7-4B43-95D0-5BD721D43F8A@microsoft.com...
> Many thanks. I've changed that but now it doesn't like this line:
>
> For Each oAuto In oTemplate.AutoTextEntries
>
> When I hover over oAuto it says its empty
>
> Cheers
>

step the through the code. After you get to this line

Set oTemplate = AddIns("legal.dot")

check whether oTemplate is actually assigned to anything. If it isn't, then
you need to fix that object assignment.

If it is correctly assigned, then check the value of
oTemplate.AutoTextEntries.Count. If it is zero, then oTemplate doesn't have
any autotext entries in it.


--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org


Re: Adding autotex to a template by Addy

Addy
Wed Aug 23 05:38:03 CDT 2006

I've managed to get my otemplate to be assigned to legal.dot but it says my
oauto is empty and I don't know why because there are autotext enteries in
legal.dot. This is what I've got so far:-

These are both in my form chooser:-

Dim oTemplate As Template
Dim oAuto As AutoTextEntry

The below are in a separate module:-

With frmChooser 'frmchooser is my form (a letter template)

Set oTemplate = AddIns("o:\msoffice97\winword\startup\legal.dot")
Set oAuto = AutoTextEntry (put this in entra as it wouldn't work)

For Each oAuto In oTemplate.AutoTextEntries
.CBOAddress.AddItem oAuto.Name
Next oAuto
.Show
End With

Do you have an e-mail address that I could maybe sent my whole document to
you on to find out where I'm going wrong as it is a long and complex form

cheers

"Jonathan West" wrote:

>
> "Addy" <Addy@discussions.microsoft.com> wrote in message
> news:51AE8A72-8FA7-4B43-95D0-5BD721D43F8A@microsoft.com...
> > Many thanks. I've changed that but now it doesn't like this line:
> >
> > For Each oAuto In oTemplate.AutoTextEntries
> >
> > When I hover over oAuto it says its empty
> >
> > Cheers
> >
>
> step the through the code. After you get to this line
>
> Set oTemplate = AddIns("legal.dot")
>
> check whether oTemplate is actually assigned to anything. If it isn't, then
> you need to fix that object assignment.
>
> If it is correctly assigned, then check the value of
> oTemplate.AutoTextEntries.Count. If it is zero, then oTemplate doesn't have
> any autotext entries in it.
>
>
> --
> Regards
> Jonathan West - Word MVP
> www.intelligentdocuments.co.uk
> Please reply to the newsgroup
> Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org
>
>

Re: Adding autotex to a template by Jonathan

Jonathan
Wed Aug 23 17:06:47 CDT 2006


"Addy" <Addy@discussions.microsoft.com> wrote in message
news:9551A6ED-1B69-40DA-A8BB-1AA661B5C2BC@microsoft.com...
> I've managed to get my otemplate to be assigned to legal.dot but it says
> my
> oauto is empty and I don't know why because there are autotext enteries in
> legal.dot. This is what I've got so far:-
>
> These are both in my form chooser:-
>
> Dim oTemplate As Template
> Dim oAuto As AutoTextEntry
>
> The below are in a separate module:-
>
> With frmChooser 'frmchooser is my form (a letter template)
>
> Set oTemplate = AddIns("o:\msoffice97\winword\startup\legal.dot")
> Set oAuto = AutoTextEntry (put this in entra as it wouldn't work)
>
> For Each oAuto In oTemplate.AutoTextEntries
> .CBOAddress.AddItem oAuto.Name
> Next oAuto
> .Show
> End With
>
> Do you have an e-mail address that I could maybe sent my whole document to
> you on to find out where I'm going wrong as it is a long and complex form

OK send it to jwest@mvps.org. I might not have time to look before I go on
holiday this weekend for a fortnight, but I'll see what i can do.


--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org


Re: Adding autotex to a template by Addy

Addy
Thu Oct 12 08:32:02 CDT 2006

Sorry to nag but I just want to get this off my mind - but did you managed to
look at my e-mail with attachments I sent to your colleague. Sorry to send
it to work but your e-mail address wasn't complete.

Many thanks for your help

Addy

"Jonathan West" wrote:

>
> "Addy" <Addy@discussions.microsoft.com> wrote in message
> news:B1201018-3470-44E6-979C-CE535120D998@microsoft.com...
> >I have a letter template macro as a form chooser and I would like to add
> > various autotext in a list so that they can be added to the address
> > bookmark
> > in the template. Is there a way or would I have to add each company name
> > to
> > a module as an additem and then put the addresses in a macro in the form
> > chooser? If there is a better way which will pick up the autotex which
> > are
> > contained in a global template in startup then that would be great as then
> > I
> > wouldn't have to add a new macro every time someone requires a new address
> > adding to the list.
>
>
> In VBA, you can create a loop to iterate through the AutotextEntries
> collection of any Template object, get the Name property of each
> AutoTextEntry in turn and use Additem to add that to the listbox in your
> form. Something like this
>
> Dim oTemplate As Template
> Dim oAuto as AutotextEntry
> Set oTemplate = Addins("My Global Template.dot")
> For Each oAuto in oTemplate.AutoTextEntries
> ListBox1.AddItem oAuto.Name
> Next oAuto
>
>
> --
> Regards
> Jonathan West - Word MVP
> www.intelligentdocuments.co.uk
> Please reply to the newsgroup
> Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org
>
>

Re: Adding autotex to a template by Addy

Addy
Tue Oct 17 04:23:01 CDT 2006

Sorry to nag but I just want to get this off my mind - but did you managed to
look at my e-mail with attachments I sent to your colleague. Sorry to send
it to work but your e-mail address wasn't complete.

Many thanks for your help

Addy



"Jonathan West" wrote:

>
> "Addy" <Addy@discussions.microsoft.com> wrote in message
> news:9551A6ED-1B69-40DA-A8BB-1AA661B5C2BC@microsoft.com...
> > I've managed to get my otemplate to be assigned to legal.dot but it says
> > my
> > oauto is empty and I don't know why because there are autotext enteries in
> > legal.dot. This is what I've got so far:-
> >
> > These are both in my form chooser:-
> >
> > Dim oTemplate As Template
> > Dim oAuto As AutoTextEntry
> >
> > The below are in a separate module:-
> >
> > With frmChooser 'frmchooser is my form (a letter template)
> >
> > Set oTemplate = AddIns("o:\msoffice97\winword\startup\legal.dot")
> > Set oAuto = AutoTextEntry (put this in entra as it wouldn't work)
> >
> > For Each oAuto In oTemplate.AutoTextEntries
> > .CBOAddress.AddItem oAuto.Name
> > Next oAuto
> > .Show
> > End With
> >
> > Do you have an e-mail address that I could maybe sent my whole document to
> > you on to find out where I'm going wrong as it is a long and complex form
>
> OK send it to jwest@mvps.org. I might not have time to look before I go on
> holiday this weekend for a fortnight, but I'll see what i can do.
>
>
> --
> Regards
> Jonathan West - Word MVP
> www.intelligentdocuments.co.uk
> Please reply to the newsgroup
> Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org
>
>

Re: Adding autotex to a template by Addy

Addy
Tue Oct 17 04:25:02 CDT 2006

Sorry to nag but I just want to get this off my mind - but did you managed to
look at my e-mail with attachments I sent to your colleague. Sorry to send
it to work but your e-mail address wasn't complete.

Many thanks for your help

Addy



"Jonathan West" wrote:

>
> "Addy" <Addy@discussions.microsoft.com> wrote in message
> news:9551A6ED-1B69-40DA-A8BB-1AA661B5C2BC@microsoft.com...
> > I've managed to get my otemplate to be assigned to legal.dot but it says
> > my
> > oauto is empty and I don't know why because there are autotext enteries in
> > legal.dot. This is what I've got so far:-
> >
> > These are both in my form chooser:-
> >
> > Dim oTemplate As Template
> > Dim oAuto As AutoTextEntry
> >
> > The below are in a separate module:-
> >
> > With frmChooser 'frmchooser is my form (a letter template)
> >
> > Set oTemplate = AddIns("o:\msoffice97\winword\startup\legal.dot")
> > Set oAuto = AutoTextEntry (put this in entra as it wouldn't work)
> >
> > For Each oAuto In oTemplate.AutoTextEntries
> > .CBOAddress.AddItem oAuto.Name
> > Next oAuto
> > .Show
> > End With
> >
> > Do you have an e-mail address that I could maybe sent my whole document to
> > you on to find out where I'm going wrong as it is a long and complex form
>
> OK send it to jwest@mvps.org. I might not have time to look before I go on
> holiday this weekend for a fortnight, but I'll see what i can do.
>
>
> --
> Regards
> Jonathan West - Word MVP
> www.intelligentdocuments.co.uk
> Please reply to the newsgroup
> Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org
>
>