B
Barb Reinhardt
I'm using Excel 2003 and the end goal is to extract the references that are
used in different projects. I'm guessing I need to open the workbook first.
How do I programmatically determine if the workbook contains macros.
I'm going to use something like this to extract the references (I know it
needs work)
Sub ListReferences()
Dim aWB As Workbook
Dim myWS As Worksheet
Dim myReference As Reference
Dim lRow As Long
Set aWB = ActiveWorkbook
Set myWS = ThisWorkbook.Sheets(1)
Debug.Print aWB.Name
Debug.Print myWS.Name
myWS.Cells(1, 1).Value = "Name"
myWS.Cells(1, 2).Value = "Description"
myWS.Cells(1, 3).Value = "FullPath"
myWS.Cells(1, 4).Value = "GUID"
myWS.Cells(1, 5).Value = "Major"
myWS.Cells(1, 6).Value = "Minor"
lRow = 1
For Each myReference In aWB.VBProject.references
lRow = lRow + 1
myWS.Cells(lRow + 1, 1).Value = myReference.Name
myWS.Cells(lRow + 1, 2).Value = myReference.Description
myWS.Cells(lRow + 1, 3).Value = myReference.FullPath
myWS.Cells(lRow + 1, 4).Value = myReference.GUID
myWS.Cells(lRow + 1, 5).Value = myReference.Major
myWS.Cells(lRow + 1, 6).Value = myReference.Minor
Next myReference
End Sub
used in different projects. I'm guessing I need to open the workbook first.
How do I programmatically determine if the workbook contains macros.
I'm going to use something like this to extract the references (I know it
needs work)
Sub ListReferences()
Dim aWB As Workbook
Dim myWS As Worksheet
Dim myReference As Reference
Dim lRow As Long
Set aWB = ActiveWorkbook
Set myWS = ThisWorkbook.Sheets(1)
Debug.Print aWB.Name
Debug.Print myWS.Name
myWS.Cells(1, 1).Value = "Name"
myWS.Cells(1, 2).Value = "Description"
myWS.Cells(1, 3).Value = "FullPath"
myWS.Cells(1, 4).Value = "GUID"
myWS.Cells(1, 5).Value = "Major"
myWS.Cells(1, 6).Value = "Minor"
lRow = 1
For Each myReference In aWB.VBProject.references
lRow = lRow + 1
myWS.Cells(lRow + 1, 1).Value = myReference.Name
myWS.Cells(lRow + 1, 2).Value = myReference.Description
myWS.Cells(lRow + 1, 3).Value = myReference.FullPath
myWS.Cells(lRow + 1, 4).Value = myReference.GUID
myWS.Cells(lRow + 1, 5).Value = myReference.Major
myWS.Cells(lRow + 1, 6).Value = myReference.Minor
Next myReference
End Sub