Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Project References

Someone know if it's possible, e.g. by a macro, without consulting the
VBE/References menu, to get the project references list?
Still better the list of the references not found.

Thanks,
Emiliano


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 209
Default Project References

This macro will create a worksheet and put the references on it.
Hope this helps.

'==M A C R O S T A R T S H E R E=======
Public Sub ListActiveVBEReferences()

Dim refReference
Dim i As Integer, x As Integer
Dim iWorksheets As Integer, y As Integer
Dim strResultsTableName As String

strResultsTableName = "Active VBE References"

'check for an active workbook
If ActiveWorkbook Is Nothing Then
Workbooks.Add
End If

'Count number of worksheets in workbook
iWorksheets = ActiveWorkbook.Sheets.Count

'Check for duplicate Worksheet name
i = ActiveWorkbook.Sheets.Count
For x = 1 To i
If Windows.Count = 0 Then Exit Sub
If UCase(Worksheets(x).name) = _
UCase(strResultsTableName) Then
Worksheets(x).Activate
If Err.Number = 9 Then
Exit For
End If
Application.DisplayAlerts = False
ActiveWindow.SelectedSheets.Delete
Application.DisplayAlerts = True
Exit For
End If
Next

'Add new worksheet at end of workbook
' where results will be located
Worksheets.Add.Move after:=Worksheets(Worksheets.Count)

'Name the new worksheet and set up Titles
ActiveWorkbook.ActiveSheet.name = strResultsTableName
ActiveWorkbook.ActiveSheet.Range("A1").value = "Description"
ActiveWorkbook.ActiveSheet.Range("B1").value = "Name"
ActiveWorkbook.ActiveSheet.Range("C1").value = "GUID"
ActiveWorkbook.ActiveSheet.Range("D1").value = "#Major"
ActiveWorkbook.ActiveSheet.Range("E1").value = "#Minor"
ActiveWorkbook.ActiveSheet.Range("F1").value = "Path"

ActiveCell.Offset(1, 0).Select
For Each refReference In _
Application.VBE.ActiveVBProject.references
With ActiveCell
.value = refReference.Description
.Offset(0, 1).value = refReference.name
.Offset(0, 2).value = refReference.GUID
.Offset(0, 3).value = refReference.Major
.Offset(0, 4).value = refReference.Minor
.Offset(0, 5).value = refReference.FullPath
.Offset(1, 0).Select
End With
Next

'format worksheet
ActiveWindow.Zoom = 75
Range("A1:F1").Select
Range("F1").Activate
Selection.Font.Bold = True
Range("A2").Select
ActiveWindow.FreezePanes = True
Range("F1").Activate
Columns("A:F").EntireColumn.AutoFit

'format print options
On Error Resume Next

'old formatting
With ActiveSheet.PageSetup
.PrintTitleRows = "$1:$1"
.PrintTitleColumns = ""
.CenterFooter = "Page &P of &N"
.LeftMargin = Application.InchesToPoints(0.25)
.RightMargin = Application.InchesToPoints(0.25)
.TopMargin = Application.InchesToPoints(1)
.BottomMargin = Application.InchesToPoints(1)
.HeaderMargin = Application.InchesToPoints(0.5)
.FooterMargin = Application.InchesToPoints(0.5)
.CenterHorizontally = True
.CenterHeader = "&""Arial,Bold""&16&U&A"
.Orientation = xlLandscape
.PrintGridlines = True
.Order = xlOverThenDown
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = False
End With

With ActiveSheet.PageSetup
End With

Range("A1:F1").Select

Range("F1").Activate

With Selection.Font
.name = "Tahoma"
.FontStyle = "Bold"
.Underline = xlUnderlineStyleSingleAccounting
End With

Columns("D:E").Select
Range("E1").Activate

With Selection
.HorizontalAlignment = xlCenter
End With

Columns("A:F").Select
Range("F1").Activate
Columns("A:F").EntireColumn.AutoFit
Columns("F:F").Select

If Selection.ColumnWidth 50 Then
Selection.ColumnWidth = 50
End If

Columns("F:F").Select

With Selection
.WrapText = True
End With

Range("A2").Select

Application.Dialogs(xlDialogWorkbookName).Show

Exit_ListActiveVBEReferences:
Exit Sub

Err_ListActiveVBEReferences:
MsgBox "Error: " & Err & " - " & Err.Description
Resume Exit_ListActiveVBEReferences

End Sub
'=====M A C R O E N D S H E R E====



--
Hope this helps.
Thanks in advance for your feedback.
Gary Brown


"Emiliano" wrote:

Someone know if it's possible, e.g. by a macro, without consulting the
VBE/References menu, to get the project references list?
Still better the list of the references not found.

Thanks,
Emiliano



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't get rid of multiple project references in VBA Larry A[_2_] Excel Programming 0 November 11th 08 01:45 PM
Missing VBA Project References for non-VBA commands Rock Chalk Julie Excel Discussion (Misc queries) 1 January 12th 07 06:11 PM
permanent/programmatic changes to VBA Project References [email protected] Excel Programming 7 September 19th 06 02:04 AM
VB Project References Tom Chau Excel Discussion (Misc queries) 0 July 18th 06 05:17 AM
code to check for project references in VBA Qasim Ahmad Excel Programming 2 January 14th 04 03:20 PM


All times are GMT +1. The time now is 04:27 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"