Results 1 to 8 of 8
  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

    Corrupted Tools references saga (Word97/SR2)

    Sago, more like it.

    I have attached a lengthy chronicle of today's events.

    Basically, even with Andrew's helpful "AddRegExp_Ref_2" from yesterday, I still run into problems assigning the correct reference.

    I need to take an hour or two's break from this and come back with a fresh mind.

    I started by trying to write a short "Idiot's Guide To Getting Started With Regular Expressions In WordVBA", but am now considering instead "petunia propogation on an asylum window-ledge, eight storeys up"!

    I'll hammer away at this. There HAS to be a fool-proof way of getting rid of bad references, and when i find it, it will be the preamble to using Andrew's code.

    I'm very puzzled at the way the tell-tale (at the bottom of the Tools, References GUI) appears blank for a while.
    Attached Files Attached Files

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Dublin, Ireland, Republic of
    Posts
    2,697
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Corrupted Tools references saga (Word97/SR2)

    Chris,

    Your lengthy chonicle consists of

    {3EEF9758-35FC-11D1-8CE4-00C04FC2B185},

    which is the GUID for Microsoft VBScript Globals, which does not include any Regular Expresion objects.

    You need

    {3F4DACA7-160D-11D2-A8E9-00104B365C9F}

    which will give you access to Microsoft VBScript Regular Expressions 1.0 or Microsoft VBScript Regular Expressions 5.5, depending on your setup.

    Does any of this help at all ?

    Andrew

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

    Re: Corrupted Tools references saga (Word97/SR2)

    Yo! Eagle-eyes.

    You are correct.

    However I wasn't confused about the identity of the key as much as it was THERE. Later tonight I'm going to repeat the exercise, starting with flushing the "Microsoft VBScript Globals" references. No matter whether I call them by "Microsoft VBScript Globals" or by "{3EEF9758-35FC-11D1-8CE4-00C04FC2B185}", they cause problems.

    I have worked backwards/upstream from "wanting to add a reference to VBScript.DLL/2" to "wanting to develop a foolproof method of purging a system of all references to a DLL'". I had thought that would be easy (RegEdit.EXE and Explorer.EXE), but now I suspect that some of the reference information lurks elsewhere. For tonight's essay I will run RedTree's Wilbur, which indexes every byte of every file on my hard drive. If Wilbur can't find obscure detrius, how can I?



    Thanks for reading through the diary. It is too long to post, but may help crystalise my thoughts.

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

    Re: Corrupted Tools references saga (Word97/SR2)

    (later) I now have reason to believe that the ghostly references to VBScript were lurking in my Normal.dot, relics of yesterday

  5. #5
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Dublin, Ireland, Republic of
    Posts
    2,697
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Corrupted Tools references saga (Word97/SR2)

    Chris,

    I am not sure why you would wanttopurge your system of VBScript.dll, but if you actually want to purge your VBA Project of any reference to it via code try :

    Set vbRefs = Application.VBE.ActiveVBProject.References
    For Each Ref In vbRefs
    If Left(Ref.Name, 8) = "VBScript" Then
    vbRefs.Remove Ref
    End If
    Next

    That will remove all references to VBScript.dll, even if they support RegExp. To clear Microsoft VBScript Globals, stick to the GUID and use

    Set vbRefs = Application.VBE.ActiveVBProject.References
    For Each Ref In vbRefs
    If Ref.GUID = "{3EEF9758-35FC-11D1-8CE4-00C04FC2B185}" Then
    vbRefs.Remove Ref
    End If
    Next

    To refer back to setting references via code by use of the GUID, and the following,

    Sub AddRegExp_Ref_1()
    Application.VBE.ActiveVBProject.References. _
    AddFromGuid "{3F4DACA7-160D-11D2-A8E9-00104B365C9F}", <font color=red>0</font color=red>, 0
    End Sub

    This sets a reference to the default version of VBScript (Verrsion 5 or later that is) on your system. So if you have the latesst version but want to test using version 1 of RegExp, you would replace the red 0 with 1. Something you may wish to do to ensure code would run on an earlier system. The two zeros represent Major and Minor version numbers of GUIDs.

    Hope that covers at least some of the issues you are battling with.

    Andrew

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

    Re: Corrupted Tools references saga (Word97/SR2)

    > I am not sure why you would wanttopurge your system of VBScript.dll

    Andrew, I'm not knocking your excellent code below, but my reason for getting all squirrely about VBScript.dll (in this case) was that the code you provided yesterday suddenly wouldn't do the trick. And the problem appeared to be not in any current project, but in another project (happened to be Normal.dot, but possibly could be any other add-in) that prevented Word from doing the right thing.


    My case might be an extreme case (although as Kevin had noted, from time to time his registry seems to get cluttered with garbage).

    The average VBA user, having used RegEdit to remove all traces of VBScript.DLL finds that Andrew's code STILL won't add the reference correctly.

    In this case, my plan is to temporarily remove the offending file from the system, by cut-to-floppy or by renaming, in a final effort to purge all traces.


    I might try adding the plain VBScript reference back into my Normal.dot, then see if I can fail with your AddRegExp_Ref_2 (as happened this morning), then use your code posted just now to see if that will thwart the ghostly reference within Normal.dot. I'm betting it won't.

    This morning I was trying to determine WHERE the ghost reference was stored, in order to do something about it. Once I knew that the ghost reference was in, say, Normal.dot, I could use your code to cleanse Normal.dot.


    I hope that makes sense. I was so FRUSTRATED this morning, knowing that everything worked fine last night, but that after sun-rise nothing worked! It was the old programmer lament "I haven't changed anything, honest!", but in my case I'd copied code to a new project and failed to unset the old references, I bet.

  7. #7
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Dublin, Ireland, Republic of
    Posts
    2,697
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Corrupted Tools references saga (Word97/SR2)

    from the cammand line you might try

    <big>Regsvr32 /u c:windowssystemvbscript.dll</big>

    which will unregister VBScript.dll.

    Re-establish registration with

    Regsvr32 c:windowssystemvbscript.dll

    Andrew

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

    Re: Corrupted Tools references saga (Word97/SR2)

    > Regsvr32 /u

    Sure, but, ...... the registry was clean, purged, repeatedly by TonyArts Registry Cleaner and by a rigorous search using RegEdit.exe. There was nary a trace of VBSCRIPT.DLL in my registry. Yet your add-registry code (from yesterday) still wouldn't correctly assign the "/2" switch setting. Further, that tell-tale area at the foot of the Tools, References Dialogue was mysteriously blank.


    That was a large part of my frustration - I knew that a stray VBSCRIPT.DLL reference was lurking somewhere, but couldn't shake it by purging the registry OR by rebuilding my project from its BAS source code.


    My suspicion sneaks further to suggest that when WordVBE is assigning a reference, it queries Normal.Dot and any other add-ins to see if they will be a party to the party.

    Normal.dot still seemed to know all about VBSCRIPT.DLL long after the registry denied all knowledge, and that seemd to confuse what happened when I tried to re-assign VBSCRIPT.DLL/2.

Posting Permissions

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