![]() |
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 |
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 |
All times are GMT +1. The time now is 09:45 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com