#ゃ、全部scrapじゃん、という意見もあるかもしれないですけれどもXD
'ActiveWorkbookの参照設定済みライブラリ列挙
Sub try()
Const x As Long = 4
Dim cnt As Long
Dim i As Long
Dim v
Dim ret() As String
On Error GoTo extLine
With ActiveWorkbook.VBProject.References
cnt = .Count
ReDim ret(0 To cnt, 1 To x)
For Each v In Array("Name", "Description", "FullPath", "GUID")
i = i + 1
ret(0, i) = v
Next
For i = 1 To cnt
With .Item(i)
ret(i, 1) = .Name
ret(i, 2) = .Description
ret(i, 3) = .FullPath
ret(i, 4) = .GUID
'Debug.Print ret(i, 1), ret(i, 2), ret(i, 3), ret(i, 4)
End With
Next
End With
'新規Book追加して列挙
With Workbooks.Add(xlWBATWorksheet).Sheets(1).Range("A1").Resize(cnt + 1, x)
.Value = ret
.Columns.AutoFit
End With
extLine:
With Err()
If .Number <> 0 Then
MsgBox .Number & "::" & .Description
End If
End With
End Sub
※Excelメニュー[Alt][t][m][s]で
#2002/2003
[信頼できる発行元]..[□ VisualBasicプロジェクトへのアクセスを信頼する]
#Excel2007/2010
[開発者向けのマクロ設定]..[□ VBAプロジェクトオブジェクトモデルへのアクセスを信頼する]
チェックが必要。
'ActiveWorkbookの参照設定済みライブラリ列挙
Sub try()
Const x As Long = 4
Dim cnt As Long
Dim i As Long
Dim v
Dim ret() As String
On Error GoTo extLine
With ActiveWorkbook.VBProject.References
cnt = .Count
ReDim ret(0 To cnt, 1 To x)
For Each v In Array("Name", "Description", "FullPath", "GUID")
i = i + 1
ret(0, i) = v
Next
For i = 1 To cnt
With .Item(i)
ret(i, 1) = .Name
ret(i, 2) = .Description
ret(i, 3) = .FullPath
ret(i, 4) = .GUID
'Debug.Print ret(i, 1), ret(i, 2), ret(i, 3), ret(i, 4)
End With
Next
End With
'新規Book追加して列挙
With Workbooks.Add(xlWBATWorksheet).Sheets(1).Range("A1").Resize(cnt + 1, x)
.Value = ret
.Columns.AutoFit
End With
extLine:
With Err()
If .Number <> 0 Then
MsgBox .Number & "::" & .Description
End If
End With
End Sub
※Excelメニュー[Alt][t][m][s]で
#2002/2003
[信頼できる発行元]..[□ VisualBasicプロジェクトへのアクセスを信頼する]
#Excel2007/2010
[開発者向けのマクロ設定]..[□ VBAプロジェクトオブジェクトモデルへのアクセスを信頼する]
チェックが必要。