Consulting

Results 1 to 10 of 10

Thread: Storing data for use within a procedure

  1. #1
    VBAX Regular
    Joined
    Jul 2014
    Posts
    79
    Location

    Storing data for use within a procedure

    Guys,

    General question regarding the storage of data which will be used regularly by a procedure;

    Say the data is 100+ MS Word pages, all containing tables of data which relate to different things. Would it be better storing it in:


    • the template which will use the data
    • a seperate Word document
    • multiple word documents dependant on data


    An additional Excel worksheet may also be used for certain data.

    I am basically trying to get a general idea of the best way to store data for use within an application - if that exists.

    Cheers,
    Joe

  2. #2
    Moderator VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,814
    Location
    best way to store data for use [by MS Office Applications]
    IMO, MS Access, followed by MS Excel, with *.csv files a distant third. Word not in the same class.
    I expect the student to do their homework and find all the errrors I leeve in.


    Please take the time to read the Forum FAQ

  3. #3
    VBAX Regular
    Joined
    Jul 2014
    Posts
    79
    Location
    Is it common to use MS Access for a database of common text / paragraphs?

  4. #4
    Moderator VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,814
    Location
    Best is Access or Excel
    Say the data is 100+ [???], all containing tables of data


    Access or Excel might not be best
    common text / paragraphs


    If you change your mind again and say that it is images you want to store, then I give up.
    I expect the student to do their homework and find all the errrors I leeve in.


    Please take the time to read the Forum FAQ

  5. #5
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,728
    Location
    Quote Originally Posted by Jfp87 View Post
    General question regarding the storage of data which will be used regularly by a procedure;
    What is the data?

    Numbers?

    Blocks of text?

    Tables an tables?
    ---------------------------------------------------------------------------------------------------------------------

    Paul


    Remember: Tell us WHAT you want to do, not HOW you think you want to do it

    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

  6. #6
    VBAX Regular
    Joined
    Jul 2014
    Posts
    79
    Location
    It will mostly be blocks of text Paul. How would you do it?

  7. #7
    Microsoft Word MVP 2003-2009 VBAX Guru gmaxey's Avatar
    Joined
    Sep 2005
    Posts
    3,340
    Location
    If you need to store blocks of text then simply store them as building blocks in the template with the running code or any loaded template. It really doesn't matter.
    Greg

    Visit my website: http://gregmaxey.com

  8. #8
    Moderator VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,814
    Location
    @ Greg,

    The OP says he has hundreds of Tables of blocks of text. Would that make a difference?
    I expect the student to do their homework and find all the errrors I leeve in.


    Please take the time to read the Forum FAQ

  9. #9
    Microsoft Word MVP 2003-2009 VBAX Guru gmaxey's Avatar
    Joined
    Sep 2005
    Posts
    3,340
    Location
    SamT,

    I created a new template containing a single table then ran this code:

    Sub Test()
    Dim oTbl As Table
    Dim i As Long
    Dim oRng As Word.Range
    For i = 1 To 500
    Set oRng = ActiveDocument.Tables(1).Range
    ThisDocument.AttachedTemplate.BuildingBlockEntries.Add Name:="New BB Entry" & i, Type:=wdTypeAutoText, Category:="General", Range:=oRng
    Next i
    End Sub

    The macro took about 45 seconds to run, and I was left with 500 building blocks (all the same of course) which I could select and insert into any document. A similar process could be used to create 500 unique building blocks and is should work equally as well.

    I don't think "several hundred" is a critical factor. How the OP intends to use the data, e.g., insert it, read it, etc. is probably the significant factor.
    Greg

    Visit my website: http://gregmaxey.com

  10. #10
    Moderator VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,814
    Location
    Thanks,

    I do hope that Jfp87 comes back and sees that there are experts here who can help him/her.
    I expect the student to do their homework and find all the errrors I leeve in.


    Please take the time to read the Forum FAQ

Posting Permissions

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