Show us the relevant bit of code. Variables do different things depending on
how they are declared.

Signature
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
> Document New event, stored in the template:
Private Sub Document_New()
ThisDocument.Variables("latinChar").Value = 1
End Sub
> This is the event that is supposed to do the counting:
Private Sub CommandButton1_Click()
ThisDocument.Variables("latinChar").Value =
ThisDocument.Variables("latinChar").Value + 1
End Sub
> The button is in a form that is enabled with a macro that does the following:
Sub InsertCustomFootnotes()
UserForm1.Show
End Sub
According to another posting, variables don't preserve their values between
sessions.
If this is correct, is there another way to achieve what I want to do?
thanks,
ALBAN
> Show us the relevant bit of code. Variables do different things depending on
> how they are declared.
[quoted text clipped - 21 lines]
> > thanks in advance,
> > ALBAN
Jonathan West - 03 Sep 2005 17:31 GMT
Ah! You're taking of Document Variables, not code variables.
Document Variables are rather like Custom Document Properties. They are
saved as part of the document and therefore remain between Word sessions
when you re-open the document.

Signature
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
>> Document New event, stored in the template:
>
[quoted text clipped - 56 lines]
>> > thanks in advance,
>> > ALBAN
Jay Freedman - 03 Sep 2005 23:09 GMT
Yes, document variables are saved in the document.... but use
"ActiveDocument" instead of "ThisDocument".
--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
> Ah! You're taking of Document Variables, not code variables.
>
[quoted text clipped - 62 lines]
>>> > thanks in advance,
>>> > ALBAN
Jasonm - 24 Sep 2005 17:27 GMT
ALBAN, sorry to jump in on your thread, but I have a somewhat related
question:
Jonathan, if I were to try this in a document template would it also work?
Right now I am using an external txt file to store my numbers (I have 6
variables that I am incrementing). It could potentially be cleaner to store
them IN the document template if that would work.
I am using my variables to set the filename of the document to increment
document 001, document 002, etc...
any ideas?
Jason Canady
> Ah! You're taking of Document Variables, not code variables.
>
[quoted text clipped - 62 lines]
>>> > thanks in advance,
>>> > ALBAN
Doug Robbins - 26 Sep 2005 08:40 GMT
See the article "Creating sequentially numbered documents (such as
invoices)" at:
http://www.word.mvps.org/FAQs/MacrosVBA/NumberDocs.htm
Maybe it does what you want.

Signature
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
> ALBAN, sorry to jump in on your thread, but I have a somewhat related
> question:
[quoted text clipped - 78 lines]
>>>> > thanks in advance,
>>>> > ALBAN