Results 1 to 2 of 2
  1. #1
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    updating template libraries (word97sr2)

    Have I missed something in all the discussions on "programmatically setting references"?

    What are YOU doing to automate the process of updating template libraries?


    <pre>Public Function NukeReference(strReference As String)
    Dim aRef, colRefs
    Set colRefs = VBE.ActiveVBProject.References
    For Each aRef In colRefs
    'Debug.Print aRef.Name & "; " & aRef.FullPath & "; " & aRef.Type
    If InStr(1, aRef.FullPath, strReference, vbTextCompare) > 0 Then
    colRefs.Remove aRef
    End If
    Next
    'Sub TESTNukeReference()
    ' Call NukeReference("indxr105.dot")
    'End Sub
    End Function
    </pre>


    The above code is based on code posted in an earlier thread.


    The colRefs.Remove fails if the template is in use by another template (in my case, practically every application template refers to Utils.dot, and several applications refer to Indxr.dot).

    The only solution I've found so far is to exit Word97SR2, move/delete the file, and then re-enter to nuke the reference. That's not acceptable as a programming method.



    I can't believe I'm the only one with this problem - I want to install a "later" version of a template, where "later" is defined solely on FileDateTime.

    Given a Source template (e.g. Indxr174.dot), I can inspect the existing colRefs and determine that one of the following scenarios exist:

    1) A file with the same name exists(e.g. Indxr174.dot), but is an earlier date (older version)

    2) A file with the same GENERIC name exists(e.g. Indxr173.dot), but is an earlier date (older version)

    3) NO file with the same GENERIC name exists.


    In case (3) the procedure is simple:- use the NAME statement and add the reference

    In cases (1) and (2) we need to drop the reference before we KILL the file, and we need to KILL the file before we can effect the move via NAME.


    Word97SR2 won't let me drop the reference to Indxr173.dot while some other template is using it.

    I'm considering writing code that loops through all the references (colRefs) and drops those that it can, maintaining a record of those that are dropped, then effects the KILL/NAME to install any new versions, then re-references the dropped references. That seems like, well, overKill to me.

  2. #2
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: updating template libraries (word97sr2)

    I think I have solved (for me, for now) the problem of un-hooking Startup group templates (in Word) and references (in VBE).

    The code is embedded in my installation program IMove.dot (IMove as in "I move templates from the installation folder to the Startup folder").

    I have u/l the latest version of Utils.dot (4-Sep-2002 16:38) to my downloads page. If you d/l Utils.zip from there to a temporary folder, execute the PKZip file to expand, you'll see IMove009.dot.

    Execute Imove009.dot (by double-clicking) and for now, use the IMove toolbar to execute the Auto function. I'm reluctant to release a fully-equipped AutoExecute version on the world of Woody's.




    IMove009 should recognise your existing startup folder and install Utils174.DOT as "Utils.dot" in your startup folder. From that point, you should quit Word (again, I'm still not game to AutoExit on y'all) and then reload Word. After reloading Word, write this little macro in Normal.dot to check that you do indeed have access to Utils, and that it was properly installed:

    <pre>Sub TESTUtils()
    MsgBox U.strDateTime
    End Sub
    </pre>




    For those of you who want to try installing updated versions of your own applications, drag a copy of a template to the same folder in which you UNZipped IMove009.dot, and repeat the procedure from Double-clicking on IMove009.dot.






    For those who were following the various threads related to Nuking references, you may want to focus on this code within IMove009.dot:

    <pre> ' Clear all Startup items
    Call NukeAddIn(strStartUpPath)
    DoEvents
    Call NukeReference(strStartUpPath)
    DoEvents
    </pre>




    I make no guarantees. I continue to test IMove, but it does seem to solve a problem that's been bugging me for what seems like 57 years, but can't possibly be more than 56.

Posting Permissions

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