Results 1 to 3 of 3
  1. #1
    5 Star Lounger
    Join Date
    Aug 2001
    Location
    Confoederatio Helvetica
    Posts
    602
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I'm working on automating some manual processes and looking for some 'pointers'. We issue bulletins that have a sequential number, and a text subject. - like "Bull 1234 current subject". The previous bulletin would have been "Bull 1233 previous subject", and the next one will be "Bull 1235 different subject".

    Currently my macro throws up a dialogue box and asks the user to enter the Bull number and the Subject along with some other information. The next step saves the document as "Bull 1234 current subject.doc" and then the user is free to input the text of the bulletin.

    So far the user has to look up the last Bull number, to enter the next one, and I'd like to automate this. I had a look at storing the Bull number as a document variable - but this doesn't allow any room for error (i.e. a Bull that is started but not completed will throw the numbering off)

    My idea is to create an 'index doc' that will live in the same folder (the only other docs in this directory would be Bull docs) that would serve both as an index and as a source for the next number. So my macro would need to open the index, take the last number, add one to it, return to the new document and after the user completes the dialog box and populate the subject field, save and close. If a Bull is unused then the index document could be edited accordingly (manually).

    I'm assuming this is doable (I did something similar years ago in Word Basic), but appreciate any comments suggestions on how this would actually work in VB.

    Many thanks

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    I'd use a text file. See Creating sequentially numbered documents (such as invoices) on the Word MVP site for an example.


  3. #3
    Platinum Lounger
    Join Date
    Dec 2000
    Location
    Queanbeyan, New South Wales, Australia
    Posts
    3,730
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I've successfully used a txt file to control a whole swag of things from within Word VBA.

    Having said that, another approach I have used for a similar need is to use a "dir" function to iterate through files in a folder with a specified name structure.
    Subway Belconnen- home of the Signboard to make you smile. Get (almost) daily updates- follow SubwayBelconnen on Twitter.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •