How to keep track on documents made? 
Author Message
 How to keep track on documents made?

Dear group,

I want to create document-names, based on:
- initials of user (Bill Clinton equals bci or below common intelligence ;-)
- date ( yymmdd)
- sequence ( nn , ie. first document of user bci is 01, second is 02, etc.),
of course per day, just to make it unique, assuming Bill won't   write more
than 99

To do this I have to
- convert the date to a string --> BUT HOW?
- concatenate the initials to it --> with & I believe
- concatenate the right sequence --> BUT WHERE TO KEEP TRACK OF IT, based on
a particular user?

Example: bcl010703-05 (the 5th document of user Bill Clinton, created on
third of July, 2001.)
All this is stored in my Userform, where the user will have the opportunity
to override.

Please help me, I'm rather new to VBA.

Thanks in Advance, Gerrit Bon.



Sat, 27 Dec 2003 23:04:09 GMT  
 How to keep track on documents made?
Hi Gerrit

Quote:
> - convert the date to a string --> BUT HOW?

    Format(date,"yymmdd")

Quote:
> - concatenate the initials to it --> with & I believe

If the username in Word is filled correctly (Tools - Options - Userdetails)
you could use the name that's stored there as a default. You can get it
with: Application.Username. Trick is now to separate first name or initials
and last name. Which version of Word are you using? Word 2000/XP is easier
then Word 97. In Word 2000/XP you can use the function Split to built an
array with the found elements.

In Word97 the trick is to separate the username based on points or spaces in
between the words you find in the username. Another option would be to ask
for the userdetails once and store it in the registry or an ini-file

Quote:
> - sequence ( nn , ie. first document of user bci is 01, second is 02,
etc.),
> of course per day, just to make it unique, assuming Bill won't   write
more
> than 99

You can keep track of a counter in an ini file or in the registry. Make sure
people have write rights on this file if you use an ini. You can use the
method PrivateProfileString to write and read from an ini.
To see an example, visit this article on the MVP site which has code that
stores and reads a value for each new document:

"Creating sequentially numbered documents (such as invoices)"
http://www.mvps.org/word/FAQs/MacrosVBA/NumberDocs.htm

If you need more help, please post a reply to this message in the newsgroup
and add the relevant part of the code you've got so far. This way it's
easier for people out here to help you  find an adequate solution.

Hope this helps,
Groeten,
Astrid

So that all can benefit from the discussion, please post all follow-ups to
the newsgroup.
Visit the MVP Word FAQ site at http://www.mvps.org/word/



Sun, 28 Dec 2003 01:28:19 GMT  
 How to keep track on documents made?
Dear Astrid,

Thanks so far! It's good to see the service of mvps.org working like this.

A few comments.

  Declaration of a public variable:
Public MyDate        As Date
  Made the date conversion in Private Sub UserForm_Initialize():     MyDate
= Format(Date, "yymmdd")
    >>according to debugging-info, Date is: 10-7-2001

Why do I get this stunning result: MyDate is: 17-4-1929 ???

I have an idea: it's because I'm trying to put a date-format in a text
string?

TIA, Gerrit Bon.



Quote:
> Hi Gerrit

> > - convert the date to a string --> BUT HOW?

>     Format(date,"yymmdd")

> > - concatenate the initials to it --> with & I believe



Sun, 28 Dec 2003 02:41:33 GMT  
 How to keep track on documents made?
Hi Gerrit,

Quote:
>   Declaration of a public variable:
> Public MyDate        As Date
>   Made the date conversion in Private Sub UserForm_Initialize():
MyDate
> = Format(Date, "yymmdd")
>     >>according to debugging-info, Date is: 10-7-2001

> Why do I get this stunning result: MyDate is: 17-4-1929 ???

> I have an idea: it's because I'm trying to put a date-format in a text
> string?

Yep. Absolutely right. Declare a variable as string instead:

    Dim sDate as String
    sDate = Format(Date, "yymmdd")

Groetjes,
Astrid

So that all can benefit from the discussion, please post all follow-ups to
the newsgroup.
Visit the MVP Word FAQ site at http://www.mvps.org/word/



Sun, 28 Dec 2003 06:01:13 GMT  
 How to keep track on documents made?
Dear group,

The problems concerning sequential numbering and date are solved by Astrid:
THANKS!

The last problem of initials is still pending. I decided not to use the
Application Username for the following reasons:
1. the solution has to be Word97 AND Word 2000/XP compatible
2. too much coding

I decided to put the initials in a listbox. Example:

Username        Initials
Bill Clinton       bcl
Gerrit Bon        gbo
Piet Paulusma    ppa

I create a one column listbox by AddItem:

  With alg_initialen
    .AddItem "Gerrit Bon"
    .AddItem "Bill Clinton"
    .AddItem "Piet Paulusma"
    End With

How can I use the same AddItem to add 2 columns??

Thanks in Advance,  Gerrit Bon.



Quote:
> Hi Gerrit

> > - concatenate the initials to it --> with & I believe

> If the username in Word is filled correctly (Tools - Options -
Userdetails)
> you could use the name that's stored there as a default. You can get it
> with: Application.Username. Trick is now to separate first name or
initials
> and last name. Which version of Word are you using? Word 2000/XP is easier
> then Word 97. In Word 2000/XP you can use the function Split to built an
> array with the found elements.

> In Word97 the trick is to separate the username based on points or spaces
in
> between the words you find in the username. Another option would be to ask
> for the userdetails once and store it in the registry or an ini-file



Sun, 28 Dec 2003 17:33:14 GMT  
 How to keep track on documents made?
Hi Gerrit,

Nothing could be much simpler or less code than

Application.UserInitials

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:
> Dear group,

> The problems concerning sequential numbering and date are solved by
Astrid:
> THANKS!

> The last problem of initials is still pending. I decided not to use the
> Application Username for the following reasons:
> 1. the solution has to be Word97 AND Word 2000/XP compatible
> 2. too much coding

> I decided to put the initials in a listbox. Example:

> Username        Initials
> Bill Clinton       bcl
> Gerrit Bon        gbo
> Piet Paulusma    ppa

> I create a one column listbox by AddItem:

>   With alg_initialen
>     .AddItem "Gerrit Bon"
>     .AddItem "Bill Clinton"
>     .AddItem "Piet Paulusma"
>     End With

> How can I use the same AddItem to add 2 columns??

> Thanks in Advance,  Gerrit Bon.



> > Hi Gerrit

> > > - concatenate the initials to it --> with & I believe

> > If the username in Word is filled correctly (Tools - Options -
> Userdetails)
> > you could use the name that's stored there as a default. You can get it
> > with: Application.Username. Trick is now to separate first name or
> initials
> > and last name. Which version of Word are you using? Word 2000/XP is
easier
> > then Word 97. In Word 2000/XP you can use the function Split to built an
> > array with the found elements.

> > In Word97 the trick is to separate the username based on points or
spaces
> in
> > between the words you find in the username. Another option would be to
ask
> > for the userdetails once and store it in the registry or an ini-file



Sun, 28 Dec 2003 18:38:54 GMT  
 How to keep track on documents made?

Geri,

Quote:
> I create a one column listbox by AddItem:

>  With alg_initialen
>    .AddItem "Gerrit Bon"
>    .AddItem "Bill Clinton"
>    .AddItem "Piet Paulusma"
>    End With

> How can I use the same AddItem to add 2 columns??

Listbox terminology can seem incredibly illogical.  (You want extra
columns, but if you try using the Column property to assign the values
you get no end of confusion or your list transposed [rows as columns].)
Use the List property:

alg_initialen.ColumnCount = 2  '<--or set this in the properties window
With alg_initialen
     .AddItem
     .List(0, 0) = "Gerrit Bon"
     .List(0, 1) = "gbi"
     .AddItem
     .List(1, 0) = "Bill Clinton"
     .List(1, 1) = "bci"
     .AddItem
     .List(2, 0) = "Piet Paulusma"
     .List(2, 1) = "ppa"
End With


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



Sun, 28 Dec 2003 20:37:04 GMT  
 How to keep track on documents made?
Hi Doug,

Quote:
> Nothing could be much simpler or less code than

> Application.UserInitials

Oops .. just forgot about that one.. thanks for reminding me. Sometimes I
forget the easy way and only think of difficult solutions ;-)

Regards,
Astrid

So that all can benefit from the discussion, please post all follow-ups to
the newsgroup.
Visit the MVP Word FAQ site at http://www.mvps.org/word/



Sun, 28 Dec 2003 22:56:17 GMT  
 How to keep track on documents made?
Dear Mark,

And this is the right solution for my needs! Thanks for your reply.

Greetingz, Gerri


Quote:

> Geri,

> > I create a one column listbox by AddItem:

> >  With alg_initialen
> >    .AddItem "Gerrit Bon"
> >    .AddItem "Bill Clinton"
> >    .AddItem "Piet Paulusma"
> >    End With

> > How can I use the same AddItem to add 2 columns??

> Listbox terminology can seem incredibly illogical.  (You want extra
> columns, but if you try using the Column property to assign the values
> you get no end of confusion or your list transposed [rows as columns].)
> Use the List property:

> alg_initialen.ColumnCount = 2  '<--or set this in the properties window
> With alg_initialen
>      .AddItem
>      .List(0, 0) = "Gerrit Bon"
>      .List(0, 1) = "gbi"
>      .AddItem
>      .List(1, 0) = "Bill Clinton"
>      .List(1, 1) = "bci"
>      .AddItem
>      .List(2, 0) = "Piet Paulusma"
>      .List(2, 1) = "ppa"
> End With


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



Mon, 29 Dec 2003 01:47:15 GMT  
 
 [ 9 post ] 

 Relevant Pages 

1. Keeping track of documents on Word 95/97 with VB

2. keeping Track Of Record

3. Keeping Track of Database Modifications?!?!

4. Keeping track of Users Online

5. Keeping track of Database changes!?

6. KEEPING TRACK OF WORD DOC FILES

7. Keeping track of all those functions!?!?!

8. Keeping track of the time that Outlook was shutdown

9. Program to keep track on how much time you speend connected to internet

10. Keep track of day count

11. Keeping track of pasted text?

12. 'keep track of formatting' option

 

 
Powered by phpBB® Forum Software