Oggetto Application - VBA Excel Tutorial Italiano 31
Summary
TLDRIn this VBA tutorial, the focus shifts to integrating Excel with VBA by exploring various objects available in VBA and Excel. The application object is introduced as a gateway to the entire Excel application, offering numerous properties and methods. The video delves into using Active properties to interact with the active cell, sheet, printer, and more. It also discusses modifying global application settings like alerts and the status bar, and concludes with a practical example of automating report formatting and email sending using the application object.
Takeaways
- 📚 The video is a VBA tutorial focusing on integrating with Excel and its various components.
- 👀 Introduction to Excel's Application object, which provides access to the entire Excel application.
- 🛠️ Explanation of the Application object's extensive properties and methods, with examples like Name, Version, and Path.
- 🔍 Discussion on how to use Application object to check user permissions and version for macro execution.
- 📝 Utilization of Active properties to interact with the active cell, chart, printer, sheet, window, and workbook.
- 🔑 Access and manipulation of the active workbook's password protection through the Application object.
- 🎛️ Control over display settings such as alerts, comment indicators, formula bar, and status bar via the Application object.
- 📧 Demonstration of using the Application object to send an email with an attached file through Outlook.
- 🔄 Emphasis on the global impact of changes made through the Application object and the need to reset them after specific macros.
- 📊 Highlight of the practical applications of VBA, such as automating report formatting and email sending for regular updates.
- 🚀 Preview of upcoming tutorials on additional Excel objects like Workbook and Worksheet in future videos.
Q & A
What is the main focus of episode 31 of the VBA course?
-The main focus of episode 31 is to delve into the integration aspects between VBA and Excel, specifically looking at the various objects available in VBA and Excel.
What does the Application object in Excel VBA provide access to?
-The Application object in Excel VBA provides access to the entire Excel application. It has numerous properties and methods that can be utilized for different tasks.
How can you retrieve the name of the active sheet using VBA?
-You can retrieve the name of the active sheet using the following code: `ActiveSheet.Name`.
What is the purpose of the Application object's properties like ActivePrinter and ActiveCell?
-The properties like ActivePrinter and ActiveCell allow you to interact with and control the current active printer and cell within the Excel application, which can be useful for automating tasks and creating dynamic scripts.
How can you check the version of Microsoft Excel using VBA?
-You can check the version of Microsoft Excel using VBA by using the following code: `Application.Version`.
What is the significance of the Application object's DisplayAlerts property?
-The DisplayAlerts property of the Application object controls whether alert messages are displayed to the user during the execution of macros. It can be temporarily turned off to prevent interruptions during macro execution.
How can you use the Application object to control the display of certain elements in Excel?
-You can use the Application object's properties, such as DisplayFormulaBar, DisplayStatusBar, and DisplayCommentIndicator, to control the display of the formula bar, status bar, and comment indicators, respectively.
What is the Collection of objects in Excel VBA?
-The Collection of objects in Excel VBA refers to a group of related objects that can be accessed and manipulated as a unit, such as Workbooks, Worksheets, and Windows.
How can you directly access the active workbook's password property using the Application object?
-You can directly access the active workbook's password property using the following code: `Application.Workbooks(1).Password`.
What is the practical application of using the Application object to send an email with an attached file?
-The practical application of using the Application object to send an email with an attached file is to automate the process of formatting reports and sending them to specified recipients without manual intervention, saving time and reducing the risk of errors.
How can you use the Application object to display a dialog box in Excel VBA?
-You can use the Application object's Dialogs property to display a dialog box in Excel VBA. For example, `Application.Dialogs(xlDialogOpen).Show` will display the 'Open' dialog box.
Outlines
📘 Introduction to Excel VBA Integration
This paragraph introduces the 31st episode of a VBA course, focusing on the integration aspects with Excel. It begins by discussing the introduction of Excel VBA, object-oriented programming, and other related concepts. The speaker then explains the broad scope of Visual Basic and its integration with Excel. The paragraph highlights the importance of the Application object, which provides access to the entire Excel application, and discusses various properties and methods associated with it. The speaker also touches on practical scenarios where accessing basic information about the application can be helpful, such as controlling user permissions and handling different Excel versions for macros.
📘 Utilizing Active Properties and Methods
This paragraph delves into the use of Active properties and methods within the Excel VBA environment. The speaker explains how to access and manipulate various active components such as cells, charts, printers, sheets, and workbooks. The paragraph emphasizes the versatility of the Application object in accessing and modifying the state of the active elements in Excel. It also discusses the practical applications of these properties, such as creating graphical interfaces, managing print settings, and altering the status bar. The speaker provides examples of how these properties can be utilized to enhance the functionality and user experience of Excel applications.
📘 Advanced VBA Techniques and Outlook Integration
The final paragraph of the script explores advanced VBA techniques, including the use of the Application object to control display settings and interact with Outlook. The speaker demonstrates how to disable alerts, manage comment indicators, and modify the status bar to improve the user experience. The paragraph also showcases how VBA can be used to automate tasks, such as sending emails through Outlook using the Application object. The speaker provides a practical example of automating the formatting and sending of reports, highlighting the efficiency and convenience of using VBA for repetitive tasks.
Mindmap
Keywords
💡Excel VBA
💡Application Object
💡Active Properties
💡Macros
💡User Permissions
💡Version Compatibility
💡Worksheets and Workbooks
💡Printing and Display Settings
💡Automation in Reporting
💡Dialog Boxes
Highlights
Introduction to Excel's integration with VBA, focusing on the Application object and its extensive properties and methods.
Accessing the Application object gives you control over the entire Excel application.
Using the Application object to retrieve the name and version of the Excel application.
Checking the user's identity and permissions using the Application object's properties.
Utilizing Active properties to interact with the active cell, chart, printer, sheet, window, and workbook.
Retrieving and modifying the active sheet and workbook names directly through the Application object.
Accessing and modifying the active workbook's password protection settings.
Controlling the display of various Excel elements, such as alerts, comment indicators, and the formula bar.
Customizing the status bar display, including zoom level and sheet information.
Globally changing application settings and remembering to revert them after specific macros.
Using the Application object to display and interact with dialog boxes, such as Outlook's mail sending feature.
Automating the formatting and sending of reports via email using VBA macros.
Practical example of automating the preparation and sending of weekly and monthly reports to a commercial accountant.
Exploring the potential of the Application object in automating routine tasks and improving efficiency in Excel.
Understanding the collection of objects available in VBA and Excel, such as Workbooks, Worksheets, and Windows.
Looking forward to exploring more about the Workbook object in the next video.
Transcripts
episodio 31 del corso di vba oggi
comincia il modulo dedicato a guardare
nel dettaglio quelle che sono le parti
di integrazione con Excel quindi nella
prima parte abbiamo introdotto Excel bba
programmazione ad oggetti eccetera nella
seconda parte abbiamo visto la
programmazione non per intero perché
Visual Basic è molto ampio però abbiamo
visto tutto ciò che ci può servire per
cominciare a programmare in questa terza
fase lavoriamo appunto con i vari
oggetti che abbiamo a disposizione tra
vba ed Excel Il primo è l'application
object con l'application object abbiamo
letteralmente accesso a tutto perché se
ci pensate l'application object è
l'oggetto riguardante l'intera
applicazione ora application object vi
faccio vedere ha veramente tante tante
tante proprietà e metodi non le vediamo
tutte ma vi voglio far capire Più o meno
la mentalità con cui approcciare questo
oggetto vi faccio vedere Allora
innanzitutto mettiamo qua il punto di
domanda Se io faccio application punto
name TAC vedete ottengo Microsoft Excel
andiamo avanti facciamo punto version
otteniamo la versione di Microsoft Excel
andiamo con magari Pes vedete quindi è
il percorso in cui è lanciato Excel e
poi ad esempio Potremmo avere username
TAC queste sono solo alcune delle
proprietà che possiamo guardare con
application perché effettivamente
application è tutto Excel è il programma
che sta andando Uno potrebbe dirmi da
cosa serve questa cosa qua Beh poniamo
il caso che magari volete controllare
l'utente se l'utente non siete voi o
qualcun altro Volete dare tipi di
permessi diversi quindi se l'utente non
è quello non può utilizzare ad esempio
certi tipi di Macro oppure se la
versione è diversa andiamo a fare una
macro leggermente
modificata perché magari la versione
precedente non gestisce determinato
operazioni e via discorrendo Oppure
vogliamo assicurarci che sia Microsoft
Excel e non un'altra applicazione perché
magari è una macro che possiamo lanciare
su più applicazioni
Office ma vogliamo essere sicuri che sex
Fai questo se è World fai quest'altro
Quindi ci possa essere situazioni in cui
avere accesso alle informazioni basiche
della nostra application può essere
d'aiuto per fare un altro esempio invece
potremmo andare a prendere prendo la
cella Attiva scrivo qwerty vi faccio
vedere abbiamo tutta una serie di Active
proprietà vedete Active cell Active
chart Active printer e quant'altro
cominciamo magari con Active printer vi
faccio vedere questa è la mia stampante
Ad esempio in questo caso se stiamo
andando a creare un'interfaccia grafica
e poi le vedremo come crearle se andiamo
a creare un'interfaccia grafica Dove
possiamo selezionare le stampanti
possiamo andare a fare una cosa del
genere quindi dobbiamo utilizzare le
pennette a disposizione questa è la
stampante Attiva Oppure potrei andare a
prendere Active cell e andare a prendere
il valore se faccio invio Scusatemi Sono
sulla cella sbagliata Se faccio invio
vedete che ottengo qwerty così come
Active cell e printer ci sono tanti
Active a cui possiamo fare riferimento
Guardate Active sheet quindi il foglio
attivo che è il foglio 1 Active Windows
quindi potrei avere più finestre Active
workbook che cosa ci possono servire ad
esempio prendiamo Active shit Active
sheet punto name e vi faccio vedere che
è il nostro foglio 1 voi Mi potreste
dire Sì Edo me ci possa arrivare anche
tramite
worksheets prendo l'uno punto name TAC e
ci arrivo Qual è il discorso che qua
siamo passati dalla Collection ed è una
situazione in cui ci può servire passare
dal World cioè prendiamo il name del
primo workshop mentre invece da
application andiamo direttamente su
quello attivo va bene quindi una volta
che prendiamo quello attivo abbiamo Sì
un worshit ma siamo andati direttamente
su quell'attivo Ok quindi sono due modi
diversi qui facciamo application
workbook workshit E poi prendo il name
Qua invece andiamo diretti per Active
sheet lo stesso concetto lo potete
applicare letteralmente per la finestra
la Windows e quant'altro vi faccio
vedere se noi siamo qua potremmo fare
Active workbook punto password vedete
che abbiamo accesso alla password e
potremo andarla a mettere per vedere le
varie proprietà a cui potete passare
direttamente tramite i vari Active le
potete vedere qua se io premo sul foglio
vedete foglio a queste proprietà il nome
se vogliamo Mostrare i page Break In
questo caso non ce li mostra oppure
abbiamo mostra Right to left oppure
Abilita auto Filter Abilita calcoli
abilità formattazione condizionale
eccetera eccetera come ci siamo qua o ci
passiamo prendendo work sheets foglio 1
oppure worships 1 oppure possiamo
passare tramite Active workcit allo
stesso modo cartella di lavoro che ha
molte più cose vedete come ci possiamo
arrivare ci possiamo arrivare tramite
workbooks 1 oppure workbooks nome del
progetto altrimenti vedete che qua c'è
password dove sono passato sono passato
da application Active workbook va bene
quindi poi vedremo lo stesso giro quando
lavoreremo con workbook E worksheet ma
se volete saltare tutta la fila e
prendere direttamente quella attivo lo
potete fare da application un'altra cosa
molto molto bella che possiamo fare
tramite application e andare a
disattivare e mostrare determinate
situazioni ad esempio application punto
display c'è una categoria enorme di
display di cose che possiamo mandare a
schermo o meno display alerts ad esempio
ci permette di andare a nascondere
quelle che sono le finestre di avviso
ogni tanto vi posso comparire possiamo
andarle a nascondere è importante sapere
che però se le attivate qua dentro Cioè
se fate display Alert Falls per una
particolare macro dovete poi riattivarla
Quindi se voi fate Così giusto per
andare a fare un qualcosa nella macro
senza che l'utente venga Stoppato nella
macro Perché chiaramente la finestra
di Alert va a stoppare la macro dovete
poi ricordarvi di riattivarla Quindi se
le volete di default dovete ricordarvi
di riattivarle perché perché altrimenti
se voi non mettete questo True da qua
non importa se l'avete utilizzato una
volta in una sola macro tutta
l'applicazione avrà Disattivati gli
alert OK e quindi un problema perché
alcune volte gli alert servono quindi
Ricordatevi questo concetto perché si
applica anche ad altre cose che vediamo
ad esempio se io vado qua e faccio
display comment indicator per ora non
faccio niente ma Vi mostro che se vado
qui vado su nuovo commento scrivo
qualcosa faccio invio vedete che abbiamo
qua il segnalino viola del commento se
vado a fare display comment indicator
posso andare a mettere no indicator F5 e
vedete che è scomparso il commento però
c'è lo stesso perché se faccio tasto
destro vedete Elimina commento rispondi
a commento se vado sotto Ho solo nuovo
commento di conseguenza se io torno qua
e faccio True Facciamo così F5 vedete
che è tornato il commento quindi la
stessa cosa che possiamo fare per
display comment indicator la possiamo
fare per una serie di proprietà giusto
per spiegarvi questo concetto facciamo
vedere qualcos'altro abbiamo la formula
bar che è questa qua in alto oppure
possiamo andare a mettere la status bar
che è questa qua sotto vedete sotto i
fogli c'è questa barrettina qua sotto
dove vado a modificare lo zoom ad
esempio faccio display status bar uguale
io faccio x e se faccio F5 vedete che è
scomparsa se vado a rimettere True la
faccio ricomparire per farvi capire come
con display Stiamo andando a modificare
delle parti importanti dell'applicazione
possiamo veramente andare a cambiare
l'applicazione a piacimento Ricordatevi
però che queste cose hanno una valenza
globale Perciò se lo fate per un caso
specifico dovete poi ricordarvi di
riattivarle altrimenti resta sempre così
Va bene poi Un'ultima cosa che ci può
interessare cioè con application al
momento non lavoreremo tantissimo e per
farvi capire che tipi di proprietà
possiamo andare a modificare Abbiamo
un'ultima cosa molto divertente che
daialox questo è molto divertente Ve
l'ho inserito perché lo trovo molto
bello io vedo qua in dialox e vedete che
abbiamo una serie di dialoghi di dialog
sono le finestre che compaiono e abbiamo
una serie di dialog che possiamo
voglio mostrare quindi qualsiasi tipo di
finestra che vi può comparire su Excel
la possiamo effettivamente far comparire
noi a mano in qualsiasi momento vedete
Quante sono sono tutte Praticamente ci
sono tutte copie paste activate
onlinement e via discorrendo Io voglio
concentrarmi su XL Daia log mail Send
mail Ecco qui e poi vado a fare show per
mostrarlo e dentro vado a mettere vedete
che abbiamo una serie di argomenti
giusto vado a capo affinché ci stiamo
dentro come argomento uno Voglio andare
a mettere la mail a cui mandarlo
Facciamo così mando la mail a cui
mandarlo in questo caso mettiamo una
mail a caso che è qwerty at
quientissimo punto acurtissimo punto it
molto bene Poi virgola argomento due Ops
ho sbagliato qua devo mettere i due
punti argomento 2 TAC TAC e qua dentro
posso andare a mettere l'oggetto una
mail oggetto della mail se faccio così
vedete come si è aperta automaticamente
una finestra di messaggio di Outlook
questo perché io ho Outlook installato
già connesso qua vedete che ho messo una
mela a caso giusto per nascondere
l'indirizzo mail ma se Guardate invece a
chi la sto mandando kurticurtitissimo è
quello che ho messo qua sopra e come
oggetto oggetto oggetto della mail e ciò
che avevo qua sopra Fateci caso stiamo
inviando direttamente il file qua quindi
potreste avere e questo è un esempio
molto pratico e molto bello per questo
ve l'ho inserito possiamo avere una
macro che automaticamente magari va a
fare una formattazione eccetera e
automaticamente la va a inviare quindi
pensate Se avete dei report che dovete
mandare giornalmente settimanalmente a
diverse persone formattati in diversi
modi Penso ad esempio quando io faccio
dei documenti per il mio commercialista
me li chiede mi chiede certi documenti
settimanali certi documenti mensili o
sacro che Format ne vanno a prendere
dati in un certo modo Quindi prende la
lista delle fatture settimanalmente
vuole qualcosa mensilmente vuole
qualcos'altro automaticamente prende i
dati che io vado a registrare delle
fatture me li va a formattare in diversi
file e poi li va a inviare Ok una cosa
del genere la faccio utilizzando
application stylox che poi attorno c'è
tutt'altro delle cose che abbiamo visto
di formattazione eccetera però alla fine
io passo da qua Una volta che controllo
tutto faccio un check faccio invia e la
mail arriva al commercialista ok Quindi
questo è proprio un esempio classico
forse più pratico il più realistico tra
ciò che potevo portarvi perché lo uso
anch'io direi che con l'oggetto
application è tutto noi nel prossimo
video guardiamo l'oggetto workbook che
fa parte della Collection workbox
eccetera eccetera ma ci arriviamo nel
prossimo video A tra poco
浏览更多相关视频
Node Auth Tutorial (JWT) #5 - Mongoose Validation
How to Use ChatGPT and Excel to Automate BORING Tasks
Excel Like a Boss: Create Macros with ChatGPT
Class Objects & Constructors | Godot GDScript Tutorial | Ep 16
Descriptive Statistics in Excel
Project Based Internship Klinikgo Health System Analyst - Company Coaching Video 1
5.0 / 5 (0 votes)