L'oggetto workbook rappresenta il singolo file Excel.
Nella tabella qui sotto trovate le principali proprietà che si usano dell'oggetto Workbook. Se non indicato uno specifico Workbook i comandi vengono associati al foglio attivo.
| Azione | Come fare |
|---|
| Dichiarazione | Dim Wb As Workbook |
| Assegnazione | Set Wb = Workbooks("Esempio.xlsx") |
|
| su oggetto Workbook | Propietà o metodo | Possibili valori | Oggetto/Valore restituito |
|---|
| Attivare il file | Wb.Activate | | |
| Aprire un file | Set Wb = Workbooks.Open ("...\Esempio.xlsx") | valore String | |
| Salvare | Wb.Save | | |
| Salvare con altro nome | Wb.SaveAs "...\Esempio2.xlsm" | valore String | |
| Chiudere senza salvare | Wb.Close SaveChanges:=False | valore Boolean | |
| Chiudere salvando | Wb.Close SaveChanges:=True | valore Boolean | |
| Stampa | Wb.PrintOut (DaPag, APag, NrCopie) | valori Integer,Integer,Integer | |
| Intervalli definiti | Wb.Names | | Collection di oggetti Names |
|
| su oggetto Application | Propietà o metodo | Possibili valori | Oggetto/Valore restituito |
|---|
| Il foglio attivo | Application.ActiveWorkbook | | oggetto Workbook |
| Il foglio che contiene la macro | Application.ThisWorkbook | | oggetto Workbook |
| File aperti | Application.Workbooks | | collection di Workbook |
|