Adding a workbooks
|
Sub workbook_object_demo()
Workbooks.Add
End Sub
|
Counting total workbooks
|
Sub workbook_object_demo()
c = Workbooks.Count
Debug.Print c
End Sub
|
Opening workbooks
|
Sub workbook_object_demo()
' this will open the excel file with the name filename.xlsm
Workbooks.Open ("filename.xlsm")
End Sub
|
Activating specific workbook
|
Sub workbook_object_demo()
' this will activate the excel file with the name filename.xlsm
Workbooks("filename.xlsm").Activate
End Sub
|
Closing specific workbook
|
Sub workbook_object_demo()
' this will close the excel file with the name filename.xlsm
Workbooks.Close
End Sub
|
Looping through workbooks
|
Sub workbook_object_demo()
Dim book As Workbook
For Each book In Workbooks
Debug.Print ThisWorkbook.FullName
Next
End Sub
|
0 Comments