Re: How can I list references in a VB6 project
- From: "Geoff" <NoSpam@xxxxxx>
- Date: Sat, 3 Sep 2005 16:13:27 +0000 (UTC)
The references collection is part of the IDE,
the KB article your code refers to refers to MS Access,
the projects in Access are different than VB as they always run in the
Access IDE.
Unlike VB they can always access the reference collection of there IDE.
Projects in VB are different in that they become separated from the IDE when
they are compiled,
for that reason your project has no access to the VB reference collection.
That said, you can access VB's reference collection via an addin.
The Extensibility (Addin) model will run your example code just fine,
as it can access the VB IDE, but for reasons previously stated it will not
be part of your project.
Expected result would be an addin that reporting only on the references
(via a menu in VB, perhaps) of the current project(s) that are loaded in
the IDE.
If you want something that reports at run time about its references,
then your addin could be coded to insert the details into your project with
code
(perhaps a bas mod) so that at run time a self check is done on the target
machine.
That is of course possible but a little more involved
(maybe there is something already out there?) .
"L Mehl" <mehl_nospam@xxxxxxxxxx> wrote in message
news:2OaSe.4163$4P5.727@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> Hello --
>
> Can anyone point me to code or a discussion of how to write code to
> list the references in a project (the results I would get from clicking
> Project > References)?
>
> At a minimum, I want to see
> Name, FileName, FileLocation
> for each reference used in the project.
>
> The following code works for ACCESS but not VB.
>
> Function ReferenceInfo()
> 'MSKB 209849
> Dim strMessage As String
> Dim refItem As Reference '"Reference" is not valid
>
> 10 On Error Resume Next
> 20 For Each refItem In References
> 30 If refItem.IsBroken Then
> 40 strMessage = "Missing Reference:" & vbCrLf &
refItem.FullPath
> 50 Else
> 60 strMessage = _
> "Reference: " & refItem.Name & vbCrLf & _
> " Guid: " & refItem.Guid & vbCrLf & _
> " Location: " & refItem.FullPath & vbCrLf & _
> " BuiltIn: " & refItem.BuiltIn & vbCrLf & _
> " Kind: " & refItem.Kind & vbCrLf & _
> " Major: " & refItem.Major & vbCrLf & _
> " Minor: " & refItem.Minor & vbCrLf
>
> 70 End If
> 80 Debug.Print strMessage
> 90 Next refItem
>
> End Function
>
> Thanks for any help.
>
> Larry Mehl
>
>
.
- References:
- How can I list references in a VB6 project
- From: L Mehl
- How can I list references in a VB6 project
- Prev by Date: Re: How can I list references in a VB6 project
- Next by Date: Re: Writing text at an angle on a VB Form
- Previous by thread: Re: How can I list references in a VB6 project
- Next by thread: Re: I have do while loop problem in Visual Basic
- Index(es):
Relevant Pages
|