It may be pertinent to add I am using Word 2002.
Thanks
Janice Hardy
Support Officer
Hently and Hently Distributors
Hallo Janice,
I've got also a problem with references which I've send to the 'microsoft.private.de.partner.office' newsgroup. But I did not receive any answer yet.Did you solve your problem? Could you please take a look at my problem?
Here is my problem:
I would like to remove a reference and paste it imediatly again with a macro in Word 2002.
This code works:
**********************************************
Dim x As Object
Set x = Application.VBE.ActiveVBProject _
.References.Item("Normal")
Application.VBE.ActiveVBProject.References.Remove x
**********************************************
This code DOES NOT work:
***************************************************
Dim x As Object
Set x = Application.VBE.ActiveVBProject _
.References.Item("Microsoft Shell Controls And Automation") Application.VBE.ActiveVBProject.References.Remove x
***************************************************
(it concerns C:\windows\system32\shell32.dll)
Do you know what am I doing wrong?
Many thanks
Heike Pertzel / DATA 5 GmbH
> Hi All,
>
[quoted text clipped - 30 lines]
> Support Officer
> Hently and Hently Distributors
Heike Pertzel - 15 Jun 2005 09:16 GMT
The solution is:
Dim xx As Object
On Error Resume Next
Set xx = Application.VBE.ActiveVBProject.References.Item("Shell32")
Application.VBE.ActiveVBProject.References.Remove xx
On Error GoTo 0
Application.VBE.ActiveVBProject.References.AddFromFile ("C:\windows\system32\shell32.dll")
Heike Pertzel / DATA 5 GmbH
Hallo Janice,
I've got also a problem with references which I've send to the 'microsoft.private.de.partner.office' newsgroup. But I did not receive any answer yet.Did you solve your problem? Could you please take a look at my problem?
Here is my problem:
I would like to remove a reference and paste it imediatly again with a macro in Word 2002.
This code works:
**********************************************
Dim x As Object
Set x = Application.VBE.ActiveVBProject _
.References.Item("Normal")
Application.VBE.ActiveVBProject.References.Remove x
**********************************************
This code DOES NOT work:
***************************************************
Dim x As Object
Set x = Application.VBE.ActiveVBProject _
.References.Item("Microsoft Shell Controls And Automation") Application.VBE.ActiveVBProject.References.Remove x
***************************************************
(it concerns C:\windows\system32\shell32.dll)
Do you know what am I doing wrong?
Many thanks
Heike Pertzel / DATA 5 GmbH
"Janice" <jhardy@spamnospamevil.com> schrieb im Newsbeitrag news:_Zgge.398$J95.2005@nnrp1.ozemail.com.au...
> Hi All,
>
> I want to write a program in VBA that remove broken references to documents
> and then re establishes the reference. This is needed because the template
> has changed name and moved to another server.
>
> The code below does remove the broken reference. It even adds the
> reference, but it does not work!
>
> <SNIP>
> For Each refTest In prjProj.References
> If refTest.IsBroken Then prjProj.References.Remove refTest
> Next refTest
>
> ActiveDocument.VBProject.References.AddFromFile "C:\PO_TEMP.DOT"
> </SNIP>
>
> Documents based on the PO_TEMP.DOT should display a floating toolbar etc
> when opened. However this is not displaying if I add the reference to the
> existing documents.
>
> A point to note is this. When I open the VBE with a document based on this
> template, the project is not listed in the Projects tree. Then when going
> into the References screen the project is allready selected so I exit and
> then the project displays in the tree. However clicking on the project
> gives an error "project is unviewable"
>
> Can anybody possibly help me on this. I'm going a bit crazy!
>
> Thanks
>
> Janice Hardy
> Support Officer
> Hently and Hently Distributors
>
>