Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / July 2005

Tip: Looking for answers? Try searching our database.

VBA references

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mirka - 28 Jul 2005 14:59 GMT
Hi everyone!

Is there a way to tick or untick the references from the tools menu not
manually but with a command?
I found in VBA help a command like this:
VBE.ActiveVBProject.References.Count and tried to display in a msgbox the
references of my project but I got no result although I ckecked that when I
opened the references from the tools menu there where 5 references ticked.
Heike Pertzel - 29 Jul 2005 09:06 GMT
Hallo Mirka,

try it like this:

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

> Hi everyone!
>
[quoted text clipped - 5 lines]
> I
> opened the references from the tools menu there where 5 references ticked.
Jean-Guy Marcil - 30 Jul 2005 04:43 GMT
Mirka was telling us:
Mirka nous racontait que :

> Hi everyone!
>
[quoted text clipped - 5 lines]
> that when I opened the references from the tools menu there where 5
> references ticked.

Try this to get them listed:

'_______________________________________
Dim i As Long
Dim myRef As String

With VBE.ActiveVBProject.References
   For i = 1 To .Count
       myRef = myRef & "Ref # " & i & " : " & .Item(i).Name & vbCrLf _
           & "  Description: " & .Item(i).Description & vbCrLf _
           & "  Location: " & .Item(i).FullPath & vbCrLf _
           & "  Registry key: " & .Item(i).GUID & vbCrLf
   Next
   MsgBox myRef
End With
'_______________________________________

And look up the following methods to programmatically add references:

   .AddFromFile
   .AddFromGuid

Signature

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org


Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.